Skip to content

Commit

Permalink
fix: create QApplication for error message (#369)
Browse files Browse the repository at this point in the history
  • Loading branch information
variar committed Jul 31, 2021
1 parent 3987a4e commit d42db3e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/app/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@

#include <QtGlobal>
#include <QMessageBox>
#include <qapplication.h>


#ifdef Q_OS_WIN
Expand Down Expand Up @@ -115,9 +116,10 @@ int main( int argc, char* argv[] )

auto requiredInstructuins = CpuInstructions::SSE2;
requiredInstructuins |= CpuInstructions::SSSE3;
requiredInstructuins |= CpuInstructions::POPCNT;

if ( !hasRequiredInstructions( supportedCpuInstructions(), requiredInstructuins ) ) {
QMessageBox::critical( nullptr, "Klogg", "Current CPU is not supported",
QApplication app(argc, argv);
QMessageBox::critical( nullptr, "Klogg", "Current CPU is not supported. SSE2 and SSSE3 are required.",
QMessageBox::Close );
exit( EXIT_FAILURE );
}
Expand Down
2 changes: 1 addition & 1 deletion src/crash_handler/include/cpu_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ inline CpuInstructions operator~( const CpuInstructions& x )

inline bool hasRequiredInstructions( CpuInstructions current, CpuInstructions required )
{
if ( ( ~current & required ) == CpuInstructions::NONE ) {
if ( ( current & required ) == required ) {
return true;
}
return false;
Expand Down

0 comments on commit d42db3e

Please sign in to comment.