Jeremy C. Reed wrote:

>> You mean that the call to locked() resulted in a SIGSEGV? My
>> misunderstanding; I assumed that the crash was happening in unlock().
> 
> No crash in locked(). And unlock() is never used. (But when I did force
> it to always unlock() it appeared to exit fine.)
> 
> This is what I have when I run it and immediately exit using menu
> (without opening any document):
> 
> rainier:/usr/pkgsrc/editors/lyx-qt$ lyx
> QSettings::sync: filename is null/empty
> QSettings::sync: filename is null/empty
> Has QT_THREAD_SUPPORT defined
> Is NOT unlocked()
> lyx: Error detected by libpthread: Destroying locked mutex.
> Detected by file
>
"/home/builds/ab/netbsd-2-0-2-RELEASE/src/lib/libpthread/pthread_mutex.c",
> line 135, function "pthread_mutex_destroy".
> See pthread(3) for information.
> Abort trap (core dumped)
> 
> Here is the patch I am using to add debugging as shown above:
> 
> --- src/frontends/qt2/lyx_gui.C.orig  2005-09-17 15:15:04.000000000
> -0700
> +++ src/frontends/qt2/lyx_gui.C       2005-09-21 13:51:03.000000000 -0700
> @@ -123,8 +123,14 @@
>   LQApplication::~LQApplication()
>   {
>   #ifdef QT_THREAD_SUPPORT
> +printf("Has QT_THREAD_SUPPORT defined\n");
>   if (locked())
> +{
> +printf("Is locked()\n");
>   unlock();
> +printf("after unlock()\n");
> +}
> +else printf("Is NOT unlocked()\n");
>   #endif
>   }

Hi, Jeremy.

I'm repeating myself here but to unlock a mutex that's not locked is
undefined behaviour. We should always test whether the thing is locked.

Your solution works for you, today. Great. It's pretty well guaranteed that
it will break someone else's build. The problem is that
QApplication::locked() is lying to you. That's a Qt problem, so the
solution must be: fix Qt on NetBSD.

-- 
Angus

Reply via email to