[SOLVED] SIGSEGV 11 - on close from the taskbar but not from the mainwindow (x) cloase button
-
bq. On a side note Qt already proposes QtSingleApplication in its “Solution” catalog.
yes is true I've found it "here":http://doc.qt.digia.com/solutions/4/qtsingleapplication/qtsingleapplication.html
but not in Qt 5.3 so I can not do like #include <QSingleApplication> and because of that I will use mine one.. witch is not perfect but tried to copy some info from there... -
The solutions are not part of either Qt 4 or 5 you have to download them and integrate them in your project
-
ahammm.. thanks.. I'll try this... never knew about this any way about memory leak as far as i remember I've read somewere that Qt will manage this and close everithing for me... can you bring a good example of how I should close it not to have that memory leak? it is possible to receive because of that SIGSEGV?
-
Qt does indeed help with memory management through e.g QObject parent/child handling but it doesn't replace everything.
@
int main(int argc, char *argv[]){
//snip
AtpSingleApplication *app = new AtpSingleApplication(appId, argc, argv); << allocating the application on the heap
app->setOrganizationName("atp");
app->setOrganizationDomain("atp-trading.com");
app->setApplicationName("@atp@");
app->setApplicationVersion("1");
app->setApplicationDisplayName("atp");
//snip again
AtpMainWindow win;
win.show();
return app->exec(); << you don't delete the application, Qt can't do it for you.
}
@ -
by the way I've run the program in windows and bealiveme no SIGSEGV. usualy in windows there is a message box but everithing was fine.. wat is mre anoing is why is troing out SIGSEGV if the return is 0 - app finish corectly hm... have to do more reasearch - only on linux enviroment
-
Memory management is not the same in both OS. Did you run it using a debugger ? What happens if you delete the app object by hand ?
-
- main.cpp
@//main run
int ret = app->exec();
qDebug()<< "Del app"; //just to monitor the behaviour
delete app;
qDebug()<< "Del app after"; //just to monitor the behaviour
return ret;
@
this is perfect under linux exit with 0 end no signal caught;
- main.cpp
-
Are you can just create app on the stack
-
sorry but i do not understand what do you want to say.
bq. Are you can just create app on the stack
what that means?? Sorry but englisn is not my native language -
Search for "stack vs heap"