Qt-interest Archive, May 2008
Application fails to quit on thread termination
Message 1 in thread
I have an app. whose main looks more-or-less like this:
> int main(int argc, char* argv[])
> {
> using namespace MDP;
>
> QCoreApplication app(argc, argv);
>
> ...
>
> try
> {
>
> ProtocolManager pm("PM", parent_port, mode, remote_agent,
> orgid, projectid, transactionid);
>
> IPCListener listener(&pm);
> listener.listen_ephemeral();
>
> QObject::connect(&pm, SIGNAL( terminated() ), &app, SLOT( quit() ));
>
> pm.start();
> app.exec();
> }
where ProtocolManager is a subclass of QThread. When the pm
run() method terminates, the app does not quit.
What am I screwing up ? Any suggestions ?
--
[ signature omitted ]
Message 2 in thread
Hi,
>> QObject::connect(&pm, SIGNAL( terminated() ), &app, SLOT( quit() ));
Try changing from:
SIGNAL( terminated() )
to:
SIGNAL( finished() )
--
[ signature omitted ]
Message 3 in thread
Dimitri wrote:
> Hi,
>
>>> QObject::connect(&pm, SIGNAL( terminated() ), &app, SLOT(
>>> quit() ));
>
> Try changing from:
> SIGNAL( terminated() )
> to:
> SIGNAL( finished() )
That does the trick. I guess in that case that terminated()
is emitted only when a thread ends as a result of the
terminate() method ? If so, I misunderstood it.
--
[ signature omitted ]
Message 4 in thread
Hi,
> That does the trick. I guess in that case that terminated()
> is emitted only when a thread ends as a result of the
> terminate() method ? If so, I misunderstood it.
I don't remember when exactly these signals are emitted.
The documentation should detail when these these signals are emitted, but it
doesn't. You might want to file a bug report so that the documentation is
expanded:
http://trolltech.com/bugreport-form
--
[ signature omitted ]