rpms/qt/F-7 qt-x11-free-3.3.8-bz#243722-mysql.patch, NONE, 1.1 qt.spec, 1.136, 1.137

Than Ngo (than) fedora-extras-commits at redhat.com
Thu Jun 14 11:53:14 UTC 2007


Author: than

Update of /cvs/extras/rpms/qt/F-7
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv2511

Modified Files:
	qt.spec 
Added Files:
	qt-x11-free-3.3.8-bz#243722-mysql.patch 
Log Message:
- backport to fix #bz243722, Applications using qt-mysql crash if database is
  removed before QApplication is destroyed


qt-x11-free-3.3.8-bz#243722-mysql.patch:

--- NEW FILE qt-x11-free-3.3.8-bz#243722-mysql.patch ---
diff -Nur qt-x11-free-3.3.8/src/sql/drivers/mysql/qsql_mysql.cpp qt-x11-free-3.3.8-me/src/sql/drivers/mysql/qsql_mysql.cpp
--- qt-x11-free-3.3.8/src/sql/drivers/mysql/qsql_mysql.cpp	2007-01-11 14:38:34.000000000 +0100
+++ qt-x11-free-3.3.8-snapshot-me/src/sql/drivers/mysql/qsql_mysql.cpp	2007-05-22 17:15:26.000000000 +0200
@@ -37,7 +37,6 @@
 #include "qsql_mysql.h"
 #include <private/qsqlextension_p.h>
 
-#include <qapplication.h>
 #include <qdatetime.h>
 #include <qvaluevector.h>
 #include <qsqlrecord.h>
@@ -52,6 +51,9 @@
 
 QPtrDict<QSqlOpenExtension> *qSqlOpenExtDict();
 
+static int qMySqlConnectionCount = 0;
+static bool qMySqlInitHandledByUser = FALSE;
+
 class QMYSQLOpenExtension : public QSqlOpenExtension
 {
 public:
@@ -354,9 +356,8 @@
 {
 #ifndef Q_NO_MYSQL_EMBEDDED
 # if MYSQL_VERSION_ID >= 40000
-    static bool init = FALSE;
-    if ( init )
-	return;
+    if ( qMySqlInitHandledByUser || qMySqlConnectionCount > 1 )
+        return;
 
     // this should only be called once
     // has no effect on client/server library
@@ -366,8 +367,6 @@
 	qWarning( "QMYSQLDriver::qServerInit: unable to start server." );
 #  endif
     }
-    qAddPostRoutine(qServerEnd);
-    init = TRUE;    
     
 # endif // MYSQL_VERSION_ID
 #endif // Q_NO_MYSQL_EMBEDDED
@@ -392,8 +391,10 @@
 	d->mysql = (MYSQL *) con;
 	setOpen( TRUE );
 	setOpenError( FALSE );
+        if (qMySqlConnectionCount == 1)
+            qMySqlInitHandledByUser = TRUE;
     } else {
-	qServerInit();
+        qServerInit();
     }
 }
 
@@ -402,10 +403,15 @@
     qSqlOpenExtDict()->insert( this, new QMYSQLOpenExtension(this) );
     d = new QMYSQLDriverPrivate();
     d->mysql = 0;
+    qMySqlConnectionCount++;
 }
 
 QMYSQLDriver::~QMYSQLDriver()
 {
+    qMySqlConnectionCount--;
+    if (qMySqlConnectionCount == 0 && !qMySqlInitHandledByUser)
+        qServerEnd();
+
     delete d;
     if ( !qSqlOpenExtDict()->isEmpty() ) {
 	QSqlOpenExtension *ext = qSqlOpenExtDict()->take( this );


Index: qt.spec
===================================================================
RCS file: /cvs/extras/rpms/qt/F-7/qt.spec,v
retrieving revision 1.136
retrieving revision 1.137
diff -u -r1.136 -r1.137
--- qt.spec	23 Apr 2007 15:36:50 -0000	1.136
+++ qt.spec	14 Jun 2007 11:52:37 -0000	1.137
@@ -1,7 +1,7 @@
 Summary: The shared library for the Qt GUI toolkit.
 Name: qt
 Version: 3.3.8
-Release: 5%{?dist}
+Release: 5%{?dist}.1
 Epoch: 1
 License: GPL/QPL
 Group: System Environment/Libraries
@@ -61,6 +61,7 @@
 
 # upstream patches
 Patch200: qt-x11-free-3.3.4-fullscreen.patch
+Patch201: qt-x11-free-3.3.8-bz#243722-mysql.patch
 
 %define qt_dirname qt-3.3
 %define qtdir %{_libdir}/%{qt_dirname}
@@ -297,6 +298,7 @@
 %patch107 -p0 -b .0077-utf8-decoder-fixes
 
 %patch200 -p1 -b .fullscreen
+%patch201 -p1 -b .bz#243722-mysql
 
 # convert to UTF-8
 iconv -f iso-8859-1 -t utf-8 < doc/man/man3/qdial.3qt > doc/man/man3/qdial.3qt_
@@ -568,6 +570,10 @@
 
 
 %changelog
+* Thu Jun 14 2007 Than Ngo <than at redhat.com> -  1:3.3.8-5.fc7.1
+- backport to fix #bz243722, Applications using qt-mysql crash if database is
+  removed before QApplication is destroyed
+
 * Mon Apr 23 2007 Than Ngo <than at redhat.com> - 1:3.3.8-5.fc7
 - apply patch to fix fontrendering problem in gu_IN #228451,#228452
 




More information about the fedora-extras-commits mailing list