Angus Leeming wrote:
>>> Applying the attached hack cures the problem here.
>>> Hoooorrraaaayyyyy!!!!!

> Ok, I got busy. Here is a patch that's ready for inclusion in the cvs
> repository.

And here's a version that doesn't touch config.h but instead passes
-DQT_THREAD_SUPPORT to the compiler along with the other -DQT_FOO_BAR
flags.

-- 
Angus
Index: config/ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/config/ChangeLog,v
retrieving revision 1.86.2.44
diff -u -p -B -b -w -r1.86.2.44 ChangeLog
--- config/ChangeLog	10 May 2005 15:00:01 -0000	1.86.2.44
+++ config/ChangeLog	12 Jul 2005 09:39:11 -0000
@@ -1,3 +1,8 @@
+2005-07-12  Angus Leeming  <[EMAIL PROTECTED]>
+
+	* qt.m4 (QT_CHECK_IS_MULTITHREADED): ascertain whether the Qt library
+	has multi-threading support.
+
 2005-05-09  Angus Leeming  <[EMAIL PROTECTED]>
 
 	* Makefile.am: remove pspell.m4 and add spell.m4.
Index: config/qt.m4
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/config/qt.m4,v
retrieving revision 1.6.2.4
diff -u -p -B -b -w -r1.6.2.4 qt.m4
--- config/qt.m4	22 Apr 2005 10:59:44 -0000	1.6.2.4
+++ config/qt.m4	12 Jul 2005 09:39:12 -0000
@@ -156,6 +156,40 @@ EOF
 	AC_SUBST(QT_VERSION)
 ])
 
+dnl Ascertain whether the Qt libraries are multi-threaded or not
+AC_DEFUN([QT_CHECK_IS_MULTITHREADED],
+[
+	AC_CACHE_CHECK([whether the Qt library is multi-threaded],
+	               qt_cv_is_multithreaded,
+	[
+		AC_LANG_CPLUSPLUS
+		SAVE_CXXFLAGS=$CXXFLAGS
+		SAVE_LIBS="$LIBS"
+		CXXFLAGS="$CXXFLAGS $QT_INCLUDES $QT_LDFLAGS"
+		LIBS="$LIBS $QT_LIB"
+
+		AC_TRY_LINK(
+		[
+#define QT_THREAD_SUPPORT
+#include <qapplication.h>
+		],
+		[
+	QApplication a(0,0);
+	a.unlock();
+		],
+		qt_cv_is_multithreaded=yes,
+		qt_cv_is_multithreaded=no
+		)
+
+		LIBS="$SAVE_LIBS"
+		CXXFLAGS=$SAVE_CXXFLAGS
+	])
+
+	if test x"$qt_cv_is_multithreaded" = xyes; then
+		QT_CPPFLAGS="$QT_CPPFLAGS -DQT_THREAD_SUPPORT"
+	fi
+])
+
 dnl start here
 AC_DEFUN([QT_DO_IT_ALL],
 [
@@ -221,6 +255,8 @@ AC_DEFUN([QT_DO_IT_ALL],
 
 	QT_LIB=$qt_cv_libname;
 	AC_SUBST(QT_LIB)
+
+	QT_CHECK_IS_MULTITHREADED
 
 	if test -n "$qt_cv_libname"; then
 		QT_GET_VERSION
Index: src/frontends/qt2/ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/qt2/ChangeLog,v
retrieving revision 1.389.2.77
diff -u -p -B -b -w -r1.389.2.77 ChangeLog
--- src/frontends/qt2/ChangeLog	6 Jul 2005 12:28:49 -0000	1.389.2.77
+++ src/frontends/qt2/ChangeLog	12 Jul 2005 09:39:15 -0000
@@ -1,3 +1,8 @@
+2005-07-12  Angus Leeming  <[EMAIL PROTECTED]>
+
+	* lyx_gui.C (LQApplication d-tor): unlock the mutex if the Qt library
+	is multi-threaded.
+
 2005-06-16  Joao Luis Meloni Assirati  <[EMAIL PROTECTED]>
 
 	* QMathDialog.C (QMathDialog, insertFont): add boldsymbol font.
Index: src/frontends/qt2/lyx_gui.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/qt2/lyx_gui.C,v
retrieving revision 1.30.2.9
diff -u -p -B -b -w -r1.30.2.9 lyx_gui.C
--- src/frontends/qt2/lyx_gui.C	24 Feb 2005 11:47:36 -0000	1.30.2.9
+++ src/frontends/qt2/lyx_gui.C	12 Jul 2005 09:39:15 -0000
@@ -121,7 +121,12 @@ LQApplication::LQApplication(int & argc,
 
 
 LQApplication::~LQApplication()
-{}
+{
+#ifdef QT_THREAD_SUPPORT
+	if (locked())
+		unlock();
+#endif
+}
 
 
 #ifdef Q_OS_MAC

Reply via email to