Kdevelop termination problem unde suse 9.0 amd64 linux edition

Vodafone mario.tuerschmann at vodafone.de
Sat Feb 28 14:45:07 UTC 2004


Dear all,

i found a problem in the class BackgroundParser (file backgroundparser.cpp). If the function BackgroundParser::close() is called from the destructor of the class CppSupportPart, it may happen that the QT-thread causes a segmentation fault. This is possible because the function call m_backgroundParser->wait() returns before the QT-thread terminates. In that case the QT-thread uses BackgroundParser object specific data that are no longer available (see BackgroundParser::run()). A solution for that problem is to change the following functions in languages/cpp/cppsupportpart.cpp 

CppSupportPart::~CppSupportPart()
{
    if (project())
        projectClosed();

    delete( m_driver );
    m_driver = 0;
    if( m_backgroundParser )
    {
        m_backgroundParser->close();
        
        // not really a wait function ??? ;-}}
        //m_backgroundParser->wait();
        
        delete m_backgroundParser;
        m_backgroundParser = 0;
    }
...
}
and in languages/cpp/backgroundparser.cpp

void BackgroundParser::close()
{
    QMutexLocker locker( &m_mutex );
    m_close = true;
    m_canParse.wakeAll();

    // safer termination
    while (running())
        sleep(1);
}
This way guarantees that the thread can use the object data and terminates before the destructor is called. It works perfect on my 64 Bit linux (amd64) so i guess the QT - libraries may have a different behaviour on particular systems.

It would be great if i get r/w - access to the cvs database to remove the problem.

Best regards
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20040228/0a95d5a5/attachment.html>


More information about the KDevelop-devel mailing list