Qt-interest Archive, March 2007
[qt 4.2.2] QApplication::exit()
Message 1 in thread
Hi there,
I've got a problem closing my application, which is actually a framework
with several plugins (DLLs). I start the application
(main)
...
QApplication a(argc, argv);
a.connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit()));
...
and try to close it from within a plugin's dialog:
...
QApplication::closeAllWindows();
QApplication::exit();
QApplication::quit();
...
Indeed all windows are closed and nothing is visible any more, however,
the application (process) is still running and occupying memory.
Any ideas what I am doing wrong here? All I want to do is just terminate
the process ...
TIA,
r.
--------------------------------------------------------------------
Rene Kaiser
Institute of Information Systems & Information Management
JOANNEUM RESEARCH Forschungsgesellschaft mbH
Steyrergasse 17, A-8010 Graz, AUSTRIA
phone: +43-316-876-1173 fax: +43-316-876-1191
web: http://www.joanneum.at/iis
e-mail: mailto:rene.kaiser@xxxxxxxxxxx
--------------------------------------------------------------------
--
[ signature omitted ]
Message 2 in thread
> I've got a problem closing my application, which is actually a framework
> with several plugins (DLLs). I start the application
>
> (main)
> ...
> QApplication a(argc, argv);
> a.connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit()));
> ...
> [...]
> Any ideas what I am doing wrong here? All I want to do is just terminate
> the process ...
My best guess: You don't exit main(). Would you mind to show us the rest
of the code in main()?
BTW, your connect is IMHO completely unnecessary.
Martin
--
[ signature omitted ]
Message 3 in thread
in page about porting Qt3 to Qt4, you can read
QApplication::setMainWidget() is no longer used.
When all an application's windows are closed, the application will exit
normally.
you"ll find too in qapplication properties this*
*setQuitOnLastWindowClosed ( bool /quit/ ) (default is true)*
*maybe the problem come from some qt object created in a dll with parent
in another dll of framework that cause crash during deletion sequence,
may be its another reason?...
so... like suggested* *Martin Gebert, if you want help to investigate,
join more code...
*
*
Martin Gebert a écrit :
>> I've got a problem closing my application, which is actually a framework
>> with several plugins (DLLs). I start the application
>>
>> (main)
>> ...
>> QApplication a(argc, argv);
>> a.connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit()));
>> ...
>> [...]
>> Any ideas what I am doing wrong here? All I want to do is just terminate
>> the process ...
>
>
> My best guess: You don't exit main(). Would you mind to show us the
> rest of the code in main()?
> BTW, your connect is IMHO completely unnecessary.
>
> Martin
>
Message 4 in thread
Thank you for your answers,
unfortunately I can't post a fully enclosed code sample here, because of the system's complex framework/plugin architeture.
What we found out is that that the surrounding loop, something like ...
loop () {
showDialogThatCallsQApplicationQuit();
}
does continue after "ignoring" QApplication:exit, which was NOT what I expected. Can you think of any other way of terminating the application? All I need is an "ugly" exit, I can't expand the framework to handle a user's wish to terminate at this point.
Thankz,
Rene
________________________________
Von: veronique.lefrere@xxxxxx [mailto:veronique.lefrere@xxxxxx]
Gesendet: Donnerstag, 01. März 2007 11:37
An: qt-interest@xxxxxxxxxxxxx
Betreff: Re: [qt 4.2.2] QApplication::exit()
in page about porting Qt3 to Qt4, you can read
QApplication::setMainWidget() is no longer used.
When all an application's windows are closed, the application will exit normally.
you"ll find too in qapplication properties this
setQuitOnLastWindowClosed ( bool quit ) (default is true)
maybe the problem come from some qt object created in a dll with parent in another dll of framework that cause crash during deletion sequence, may be its another reason?...
so... like suggested Martin Gebert, if you want help to investigate,
join more code...
Martin Gebert a écrit :
I've got a problem closing my application, which is actually a framework
with several plugins (DLLs). I start the application
(main)
...
QApplication a(argc, argv);
a.connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit()));
...
[...]
Any ideas what I am doing wrong here? All I want to do is just terminate
the process ...
My best guess: You don't exit main(). Would you mind to show us the rest of the code in main()?
BTW, your connect is IMHO completely unnecessary.
Martin
Message 5 in thread
> unfortunately I can't post a fully enclosed code sample here, because of
> the system's complex framework/plugin architeture.
>
> What we found out is that that the surrounding loop, something like ...
>
> loop () {
> showDialogThatCallsQApplicationQuit();
> }
>
> does continue after "ignoring" QApplication:exit, which was NOT what I
> expected. Can you think of any other way of terminating the application?
> All I need is an "ugly" exit, I can't expand the framework to handle a
> user's wish to terminate at this point.
Yes, but you won't like it. From what you told us so far I conclude that
your "framework" is just a leetle bit (too) complicated. Perhaps you
should rethink your architecture and implementation and consider the "Qt
way" more than you did before, as well as the KISS principle. QED:
You're not able to post a coherent code snippet to illustrate your issue...
> Thankz,
No need to go 1337 here, we're just ordinary developers ;-)
Martin
--
[ signature omitted ]
Message 6 in thread
> Can you think of any other way of terminating the application?
> All I need is an "ugly" exit
::exit(1);
--
[ signature omitted ]
Message 7 in thread
Hi,
I have no solution for your problem, but
> a.connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit()));
in Qt4 by default "QApplication::quitOnLastWindowClosed" is set to "true",
so the above connection is meaningless and maybe even wrong.
Try removing it.
Regards,
Malte
--
[ signature omitted ]