Bug 83352 (Hang on closing project/exit)

Ainsley Pereira kdevgeneral at pebble.org.uk
Fri Mar 4 21:26:51 GMT 2005


Hi everyone,

I just spent a while looking into this bug, since it happens to me a
lot. I'm not very familiar with the kdevelop codebase, or Qt, so I'm
posting here with my findings so that someone more knowledgable than I
can tell me if it's a nasty hack or not.

Basically, when closing a Cpp project, the BackgroundParser is shut down
by calling the close() method. This signals that the thread should exit,
by setting m_close and waking it, then waits for the thread to not be
running. However, when the BackgroundParser's run method reaches the
end, it calls QThread::exit(). Looking through the Qt source code, this
seems to simply terminate the thread, which doesn't alter the
running/finished variables in QThread, so running() continues to return
true.

Simply removing the QThread::exit() [languages/cpp/backgroundparser.cpp:383 in the 3.2.0-rc1 tarball], and letting the run() method return lets Qt's thread class set the running/finished variables. This resolves the problem for me.

(Might also be a good idea to use wait() instead of while (running())
sleep(1); in close? seems safer to me, but I've not tried it.)

Thankyou for your attention, and sorry I didn't fix it before the RC!

~Ainsley

-
to unsubscribe from this list send an email to kdevelop-request at kdevelop.org with the following body:
unsubscribe »your-email-address«



More information about the KDevelop mailing list