Audacity crashes when opening a WAV file.
To reproduce, try: audacity file.wav

It ends up catching SIGABRT. Setting a breakpoint at abort()
reveals the abort() call comes from pthread_mutex_unlock().
Audacity is trying to unlock an unlocked mutex. The faulty code
calls the mTasksMutex.Unlock() function twice.

The corresponding code in Audacity trunk seems to have been fixed:
http://code.google.com/p/audacity/source/browse/audacity-src/trunk/src/ondemand/ODManager.cpp?r=r11963#269

The diff below fixes the port (which needs an update to the
current release but that's for another day).

ok?

Index: Makefile
===================================================================
RCS file: /cvs/ports/audio/audacity/Makefile,v
retrieving revision 1.34
diff -u -p -r1.34 Makefile
--- Makefile    3 Jan 2012 07:03:54 -0000       1.34
+++ Makefile    2 Sep 2012 23:06:28 -0000
@@ -5,7 +5,7 @@ COMMENT=        free audio editor
 V=             1.3.9
 DISTNAME=      audacity-minsrc-${V}
 PKGNAME=       audacity-${V}
-REVISION=      3
+REVISION=      4
 CATEGORIES=    audio
 
 EXTRACT_SUFX=  .tar.bz2
Index: patches/patch-src_ondemand_ODManager_cpp
===================================================================
RCS file: patches/patch-src_ondemand_ODManager_cpp
diff -N patches/patch-src_ondemand_ODManager_cpp
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_ondemand_ODManager_cpp    2 Sep 2012 23:05:36 -0000
@@ -0,0 +1,13 @@
+$OpenBSD$
+fix abort() in pthread_mutex_unlock()
+--- src/ondemand/ODManager.cpp.orig    Mon Sep  3 01:04:47 2012
++++ src/ondemand/ODManager.cpp Mon Sep  3 01:05:08 2012
+@@ -283,7 +283,7 @@ void ODManager::Start()
+          
+          //the thread will add it back to the array if the job is not yet 
done at the end of the thread's run.  
+          //mTasks.erase(mTasks.begin());  
+-         mTasksMutex.Unlock();
++         //mTasksMutex.Unlock();
+          
+          //detach a new thread.
+          thread = new ODTaskThread(mTasks[0]);//task);

Reply via email to