mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2026-06-08 08:54:41 -04:00
Moved initialization of shared memory segment to the main funcion in order to exit gracefully in case of errors.
git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@3163 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
#include <QtGui/QApplication>
|
||||
#include "mainwindow.h"
|
||||
|
||||
QSharedMemory mem_jt9("mem_jt9");
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QApplication a(argc, argv);
|
||||
@@ -18,7 +20,20 @@ int main(int argc, char *argv[])
|
||||
a.setFont(font);
|
||||
}
|
||||
|
||||
MainWindow w;
|
||||
// Create and initialize shared memory segment
|
||||
if(!mem_jt9.attach()) {
|
||||
if (!mem_jt9.create(sizeof(jt9com_))) {
|
||||
QMessageBox::critical( 0, "Error", "Unable to create shared memory segment.");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
char *to = (char*)mem_jt9.data();
|
||||
int size=sizeof(jt9com_);
|
||||
if(jt9com_.newdat==0) {
|
||||
}
|
||||
memset(to,0,size); //Zero all decoding params in shared memory
|
||||
|
||||
MainWindow w(&mem_jt9);
|
||||
w.show();
|
||||
return a.exec();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user