Jeremy C. Reed wrote:
>>> NetBSD 2.0.2 running lyx built with qt errored at exit with:
>>> lyx: Error detected by libpthread: Destroying locked mutex.
>>> Detected by file
> 
>> I've always hated this myself, although at least on linux it
>> doesn't result in a core dump.
>>
>> Anyway, I went digging. The problem and proposed fix are described
>> here:
>> http://lists.trolltech.com/qt-interest/2003-01/thread00009-0.html
>>
>> Applying the attached hack cures the problem here.
>> Hoooorrraaaayyyyy!!!!!
>>
>> Jean-Marc, I guess that we need a configure test to see whether
>> QApplication::unlock(bool = true) is present in the qt library. Can
>> I leave this piece of magic to you?
> 
> I see the new code does this unlock();
> But it is only done if locked().
> 
> I still get the problem and core dump.
> 
> I removed the check for locked() and it closed okay without error
> and no core dump.

I'm unhappy about the idea of calling unlock() if the mutex is already
unlocked. That smacks of undefined behaviour on lots of platforms.

However, the implementation of these functions (for Qt 3.3.4) suggests
that we should perhaps be calling "unlock(false)". Can you see if
that makes any difference?

bool QApplication::locked()
{
    return qt_mutex->locked();
}

void QApplication::unlock(bool wakeUpGui = TRUE)
{
    qt_mutex->unlock();

    if (wakeUpGui)
        wakeUpGuiThread();
}

-- 
Angus

Reply via email to