commit libqt4 for openSUSE:Factory
Hello community, here is the log from the commit of package libqt4 for openSUSE:Factory checked in at 2013-09-02 15:00:12 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/libqt4 (Old) and /work/SRC/openSUSE:Factory/.libqt4.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "libqt4" Changes: -------- --- /work/SRC/openSUSE:Factory/libqt4/libqt4-devel-doc.changes 2013-08-12 14:22:54.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.libqt4.new/libqt4-devel-doc.changes 2013-09-02 15:00:14.000000000 +0200 @@ -1,0 +2,17 @@ +Fri Aug 30 00:58:13 UTC 2013 - hrvoje.senjan@gmail.com + +- Added patches from upstream for resolving QtDbus bugs and crashes: + 0001-Don-t-crash-if-the-relayed-signal-was-emitted-from-t.patch + (QTBUG#31932,kde#234484) + 0002-QDBusPendingCall-add-a-missing-QWaitCondition-wakeAl.patch + (QTBUG#27809) + 0003-Fix-unprotected-access-to-QDBusPendingCallPrivate-pe.patch + (QTBUG#27809) + 0004-Remove-QDBusPendingCallPrivate-autoDelete-logic.patch + (QTBUG#27809) + 0005-Change-QDBusPendingCallPrivate-to-full-reference-cou.patch + (QTBUG#27809) +- Don't BuildRequire Mesa-devel, pkgconfig(gl) is enough, and it + doesn't pull the whole Mesa egl/gles stack + +------------------------------------------------------------------- libqt4-sql-plugins.changes: same change libqt4.changes: same change New: ---- 0001-Don-t-crash-if-the-relayed-signal-was-emitted-from-t.patch 0002-QDBusPendingCall-add-a-missing-QWaitCondition-wakeAl.patch 0003-Fix-unprotected-access-to-QDBusPendingCallPrivate-pe.patch 0004-Remove-QDBusPendingCallPrivate-autoDelete-logic.patch 0005-Change-QDBusPendingCallPrivate-to-full-reference-cou.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ libqt4-devel-doc.spec ++++++ --- /var/tmp/diff_new_pack.mJHxHi/_old 2013-09-02 15:00:19.000000000 +0200 +++ /var/tmp/diff_new_pack.mJHxHi/_new 2013-09-02 15:00:19.000000000 +0200 @@ -18,7 +18,6 @@ Name: libqt4-devel-doc -BuildRequires: Mesa-devel BuildRequires: alsa-devel BuildRequires: cups-devel BuildRequires: fdupes @@ -27,6 +26,7 @@ BuildRequires: libjpeg-devel BuildRequires: libpng-devel BuildRequires: sqlite3-devel +BuildRequires: pkgconfig(gl) %if 0%{?suse_version} BuildRequires: update-desktop-files %endif @@ -101,6 +101,16 @@ Patch152: fix-moc-from-choking-on-boost-headers.patch # PATCH-FIX-OPENSUSE qlocale_icu-no-warning-output.patch -- qWarnings about icu libraries and symbols are now only emmited in debug builds Patch153: qlocale_icu-no-warning-output.patch +# PATCH-FIX-UPSTREAM 0001-Don-t-crash-if-the-relayed-signal-was-emitted-from-t.patch (QTBUG#31932,kde#234484) +Patch154: 0001-Don-t-crash-if-the-relayed-signal-was-emitted-from-t.patch +# PATCH-FIX-UPSTREAM 0002-QDBusPendingCall-add-a-missing-QWaitCondition-wakeAl.patch (QTBUG#27809) +Patch155: 0002-QDBusPendingCall-add-a-missing-QWaitCondition-wakeAl.patch +# PATCH-FIX-UPSTREAM 0003-Fix-unprotected-access-to-QDBusPendingCallPrivate-pe.patch (QTBUG#27809) +Patch156: 0003-Fix-unprotected-access-to-QDBusPendingCallPrivate-pe.patch +# PATCH-FIX-UPSTREAM 0004-Remove-QDBusPendingCallPrivate-autoDelete-logic.patch (QTBUG#27809) +Patch157: 0004-Remove-QDBusPendingCallPrivate-autoDelete-logic.patch +# PATCH-FIX-UPSTREAM 0005-Change-QDBusPendingCallPrivate-to-full-reference-cou.patch (QTBUG#27809) +Patch158: 0005-Change-QDBusPendingCallPrivate-to-full-reference-cou.patch BuildRoot: %{_tmppath}/%{name}-%{version}-build %define common_options --opensource -fast -no-separate-debug-info -shared -xkb -openssl-linked -xrender -xcursor -dbus-linked -xfixes -xrandr -xinerama -sm -no-nas-sound -no-rpath -system-libjpeg -system-libpng -accessibility -cups -stl -nis -system-zlib -prefix /usr -L %{_libdir} -libdir %{_libdir} -docdir %_docdir/%{base_name} -examplesdir %{_libdir}/qt4/examples -demosdir %{_libdir}/qt4/demos -plugindir %plugindir -translationdir %{_datadir}/qt4/translations -iconv -sysconfdir /etc/settings -datadir %{_datadir}/qt4/ -no-pch -reduce-relocations -exceptions -system-libtiff -glib -optimized-qmake -no-webkit -no-xmlpatterns -system-sqlite -qt3support -no-sql-mysql -importdir %plugindir/imports -xsync -xinput -gtkstyle %define check_config \ @@ -177,6 +187,11 @@ %patch151 %patch152 -p1 %patch153 -p1 +%patch154 -p1 +%patch155 -p1 +%patch156 -p1 +%patch157 -p1 +%patch158 -p1 # ### 47 rediff #%patch121 -p1 # be sure not to use them libqt4-sql-plugins.spec: same change ++++++ libqt4.spec ++++++ --- /var/tmp/diff_new_pack.mJHxHi/_old 2013-09-02 15:00:19.000000000 +0200 +++ /var/tmp/diff_new_pack.mJHxHi/_new 2013-09-02 15:00:19.000000000 +0200 @@ -23,7 +23,6 @@ %define with_phonon_backend 0 %define with_qtwebkit 0 -BuildRequires: Mesa-devel BuildRequires: alsa-devel BuildRequires: clucene-core-devel BuildRequires: cups-devel @@ -42,6 +41,7 @@ BuildRequires: sqlite3-devel BuildRequires: update-desktop-files BuildRequires: xorg-x11-devel +BuildRequires: pkgconfig(gl) %if %with_phonon && %with_phonon_backend BuildRequires: gstreamer-0_10-plugins-base-devel @@ -119,6 +119,16 @@ Patch152: fix-moc-from-choking-on-boost-headers.patch # PATCH-FIX-OPENSUSE qlocale_icu-no-warning-output.patch -- qWarnings about icu libraries and symbols are now only emmited in debug builds Patch153: qlocale_icu-no-warning-output.patch +# PATCH-FIX-UPSTREAM 0001-Don-t-crash-if-the-relayed-signal-was-emitted-from-t.patch (QTBUG#31932,kde#234484) +Patch154: 0001-Don-t-crash-if-the-relayed-signal-was-emitted-from-t.patch +# PATCH-FIX-UPSTREAM 0002-QDBusPendingCall-add-a-missing-QWaitCondition-wakeAl.patch (QTBUG#27809) +Patch155: 0002-QDBusPendingCall-add-a-missing-QWaitCondition-wakeAl.patch +# PATCH-FIX-UPSTREAM 0003-Fix-unprotected-access-to-QDBusPendingCallPrivate-pe.patch (QTBUG#27809) +Patch156: 0003-Fix-unprotected-access-to-QDBusPendingCallPrivate-pe.patch +# PATCH-FIX-UPSTREAM 0004-Remove-QDBusPendingCallPrivate-autoDelete-logic.patch (QTBUG#27809) +Patch157: 0004-Remove-QDBusPendingCallPrivate-autoDelete-logic.patch +# PATCH-FIX-UPSTREAM 0005-Change-QDBusPendingCallPrivate-to-full-reference-cou.patch (QTBUG#27809) +Patch158: 0005-Change-QDBusPendingCallPrivate-to-full-reference-cou.patch BuildRoot: %{_tmppath}/%{name}-%{version}-build %define common_options --opensource -fast -no-separate-debug-info -shared -xkb -openssl-linked -xrender -xcursor -dbus-linked -xfixes -xrandr -xinerama -sm -no-nas-sound -no-rpath -system-libjpeg -system-libpng -accessibility -cups -stl -nis -system-zlib -prefix /usr -L %{_libdir} -libdir %{_libdir} -docdir %_docdir/%{base_name} -examplesdir %{_libdir}/qt4/examples -demosdir %{_libdir}/qt4/demos -plugindir %plugindir -translationdir %{_datadir}/qt4/translations -iconv -sysconfdir /etc/settings -datadir %{_datadir}/qt4/ -no-pch -reduce-relocations -exceptions -system-libtiff -glib -optimized-qmake -no-webkit -no-xmlpatterns -system-sqlite -qt3support -no-sql-mysql -importdir %plugindir/imports -xsync -xinput -gtkstyle %define check_config \ @@ -151,7 +161,6 @@ Group: Development/Libraries/X11 Requires: %{name} = %{version} Requires: %{name}-linguist = %{version} -Requires: Mesa-devel Requires: c++_compiler Requires: dbus-1-devel Requires: freetype2-devel @@ -166,6 +175,7 @@ Requires: sqlite3-devel Requires: xorg-x11-devel Requires: zlib-devel +Requires: pkgconfig(gl) # bug437293 %ifarch ppc64 Obsoletes: qt-devel-64bit @@ -417,6 +427,11 @@ %patch151 %patch152 -p1 %patch153 -p1 +%patch154 -p1 +%patch155 -p1 +%patch156 -p1 +%patch157 -p1 +%patch158 -p1 # ### 47 rediff #%patch121 -p1 # be sure not to use them ++++++ 0001-Don-t-crash-if-the-relayed-signal-was-emitted-from-t.patch ++++++
From c776e155a904527a36a1ba9c788c344ca171780c Mon Sep 17 00:00:00 2001 From: Thiago Macieira <thiago.macieira@intel.com> Date: Sun, 23 Jun 2013 16:39:56 -0700 Subject: [PATCH 1/6] Don't crash if the relayed signal was emitted from the wrong thread
Under normal circumstances, this should never happen. Signals exported to D-Bus should only be emitted from the object's own thread. That's the only way for the receiver (the QDBusAdaptorConnector object) to know what the sender object and signal were. If they are emitted from another thread, the sender will be null. Task-number: QTBUG-31932 Change-Id: Ia5a45d648985e0645bffd4abc0881fca9da64f79 (cherry-picked from qtbase commit d94961d08f91696824d9035f666af5fe28d59ef6) Reviewed-by: Peter Seiderer <ps.report@gmx.net> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> --- src/dbus/qdbusabstractadaptor.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/dbus/qdbusabstractadaptor.cpp b/src/dbus/qdbusabstractadaptor.cpp index 84c30cd..9ce843e 100644 --- a/src/dbus/qdbusabstractadaptor.cpp +++ b/src/dbus/qdbusabstractadaptor.cpp @@ -267,7 +267,15 @@ void QDBusAdaptorConnector::polish() void QDBusAdaptorConnector::relaySlot(void **argv) { QObjectPrivate *d = static_cast<QObjectPrivate *>(d_ptr.data()); - relay(d->currentSender->sender, d->currentSender->signal, argv); + if (Q_LIKELY(d->currentSender)) { + relay(d->currentSender->sender, d->currentSender->signal, argv); + } else { + qWarning("QtDBus: cannot relay signals from parent %s(%p \"%s\") unless they are emitted in the object's thread %s(%p \"%s\"). " + "Current thread is %s(%p \"%s\").", + parent()->metaObject()->className(), parent(), qPrintable(parent()->objectName()), + parent()->thread()->metaObject()->className(), parent()->thread(), qPrintable(parent()->thread()->objectName()), + QThread::currentThread()->metaObject()->className(), QThread::currentThread(), qPrintable(QThread::currentThread()->objectName())); + } } void QDBusAdaptorConnector::relay(QObject *senderObj, int lastSignalIdx, void **argv) -- 1.8.3.1 ++++++ 0002-QDBusPendingCall-add-a-missing-QWaitCondition-wakeAl.patch ++++++
From 44f3fb1eec2041c6587d3347f103ca6fa0a17dad Mon Sep 17 00:00:00 2001 From: Marc Mutz <marc.mutz@kdab.com> Date: Fri, 24 Aug 2012 10:27:02 +0200 Subject: [PATCH 2/6] QDBusPendingCall: add a missing QWaitCondition::wakeAll() call
In QDBusConnectionPrivate::waitForFinished(), threads that see pcall->waitingForFinished == true go to sleep on pcall->waitForFinishedCondition, but there was no call to waitForFinishedCondition.wakeAll() anywhere in the code, so add it. Change-Id: I8d068dc0cc4f20786eb40fd7e2bb9840d8b70c7f (cherry-picked from qtbase commit 20d7763b19400c062a07f440cc601f486be4039b) Reviewed-by: Peter Seiderer <ps.report@gmx.net> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> --- src/dbus/qdbusintegrator.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/dbus/qdbusintegrator.cpp b/src/dbus/qdbusintegrator.cpp index 96e4a12..15278b2 100644 --- a/src/dbus/qdbusintegrator.cpp +++ b/src/dbus/qdbusintegrator.cpp @@ -1782,6 +1782,7 @@ void QDBusConnectionPrivate::waitForFinished(QDBusPendingCallPrivate *pcall) // QDBusConnectionPrivate::processFinishedCall() is called automatically } pcall->mutex.lock(); + pcall->waitForFinishedCondition.wakeAll(); } } -- 1.8.3.1 ++++++ 0003-Fix-unprotected-access-to-QDBusPendingCallPrivate-pe.patch ++++++
From a9b48e98b8e90a0ccc729b00336e59acc86ad9ca Mon Sep 17 00:00:00 2001 From: Peter Seiderer <ps.report@gmx.net> Date: Mon, 17 Jun 2013 20:17:08 +0200 Subject: [PATCH 3/6] Fix unprotected access to QDBusPendingCallPrivate::pending.
In QDBusConnectionPrivate::waitForFinished() pcall->pending was used after the protection by pcall->mutex was released. A simultaneous call to QDBusConnectionPrivate::processFinishedCall() was able to reset pcall->pending to null before it was used for the q_dbus_pending_call_block(pcall->pending) call. Fixed by releasing (and setting to 0) of pcall->pending in processFinishedCall() only in case no one is waiting yet, otherwise release pcall->pending by the first thread waiting in waitForFinished(). There is still a race condition about deleting QDBusPendingCallPrivate (too early) which will be fixed in the next two commits. Task-number: QTBUG-27809 Change-Id: I040173810ad90653fe1bd1915f22d8dd70d47d8c (cherry-picked from qtbase commit 64e3bd481e5d54d555959ceecbd5c4576c571241) Reviewed-by: Peter Seiderer <ps.report@gmx.net> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> --- src/dbus/qdbusintegrator.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/dbus/qdbusintegrator.cpp b/src/dbus/qdbusintegrator.cpp index 15278b2..ae67079 100644 --- a/src/dbus/qdbusintegrator.cpp +++ b/src/dbus/qdbusintegrator.cpp @@ -1782,6 +1782,12 @@ void QDBusConnectionPrivate::waitForFinished(QDBusPendingCallPrivate *pcall) // QDBusConnectionPrivate::processFinishedCall() is called automatically } pcall->mutex.lock(); + + if (pcall->pending) { + q_dbus_pending_call_unref(pcall->pending); + pcall->pending = 0; + } + pcall->waitForFinishedCondition.wakeAll(); } } @@ -1821,9 +1827,10 @@ void QDBusConnectionPrivate::processFinishedCall(QDBusPendingCallPrivate *call) qDBusDebug() << "Deliver failed!"; } - if (call->pending) + if (call->pending && !call->waitingForFinished) { q_dbus_pending_call_unref(call->pending); - call->pending = 0; + call->pending = 0; + } locker.unlock(); -- 1.8.3.1 ++++++ 0004-Remove-QDBusPendingCallPrivate-autoDelete-logic.patch ++++++
From b638c7bf7309ea6b29f4043c86d790fbc20c006e Mon Sep 17 00:00:00 2001 From: Peter Seiderer <ps.report@gmx.net> Date: Mon, 17 Jun 2013 20:56:08 +0200 Subject: [PATCH 4/6] Remove QDBusPendingCallPrivate::autoDelete logic.
First step to fix race condition about deleting QDBusPendingCallPrivate. In a multithreaded application on a slow/single core cpu the following race (and segmentation fault) can occur: First thread A is running: A: QDBusPendingReply<> reply = pi->asyncCallWithArgumentList(method, argumentList); Then when the dbus answer arrives thread B will call: B: QDBusConnectionPrivate::processFinishedCall() B: ... B: locker.unlock() and runs until here, go on with thread A: A: reply.waitForFinished(); A: QDBusPendingCallPrivate::waitForFinished() A: { A: QMutexLocker locker(&mutex); A: if (replyMessage.type() != QDBusMessage::InvalidMessage) A: return; which returns immediately (mutex acquired, replyMessage alread set), now reply goes out of scope (destructor called) and QDBusPendingCall::d's destructor of type QExplicitlySharedDataPointer<QDBusPendingCallPrivate> deletes the reference counted object QDBusPendingCallPrivate. Now thread B continues, still in processFinishedCall() B: if (call->watcherHelper) B: call->watcherHelper->emitSignals(msg, call->sentMessage); B: B: if (msg.type() == QDBusMessage::ErrorMessage) B: emit connection->callWithCallbackFailed(QDBusError(msg), B: call->sentMessage); accessing alread deleted object QDBusPendingCallPrivate via call->... Fixed QDBusPendingCallPrivate deletion by proper reference counting will be done in the next commit. Task-number: QTBUG-27809 Change-Id: I15b3f0242471b62eaafadc763fb6a33339ff2fe1 (cherry-picked from qtbase commit 72ecf5a7ecb688a7e19cbc2f70e358a94d02edf7) Reviewed-by: Peter Seiderer <ps.report@gmx.net> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> --- src/dbus/qdbusintegrator.cpp | 7 ------- src/dbus/qdbuspendingcall_p.h | 3 +-- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/src/dbus/qdbusintegrator.cpp b/src/dbus/qdbusintegrator.cpp index ae67079..a91ba0e 100644 --- a/src/dbus/qdbusintegrator.cpp +++ b/src/dbus/qdbusintegrator.cpp @@ -1766,7 +1766,6 @@ static void qDBusResultReceived(DBusPendingCall *pending, void *user_data) void QDBusConnectionPrivate::waitForFinished(QDBusPendingCallPrivate *pcall) { Q_ASSERT(pcall->pending); - Q_ASSERT(!pcall->autoDelete); //Q_ASSERT(pcall->mutex.isLocked()); // there's no such function if (pcall->waitingForFinished) { @@ -1840,11 +1839,6 @@ void QDBusConnectionPrivate::processFinishedCall(QDBusPendingCallPrivate *call) if (msg.type() == QDBusMessage::ErrorMessage) emit connection->callWithCallbackFailed(QDBusError(msg), call->sentMessage); - - if (call->autoDelete) { - Q_ASSERT(!call->waitingForFinished); // can't wait on a call with autoDelete! - delete call; - } } int QDBusConnectionPrivate::send(const QDBusMessage& message) @@ -2063,7 +2057,6 @@ int QDBusConnectionPrivate::sendWithReplyAsync(const QDBusMessage &message, QObj return 1; } - pcall->autoDelete = true; pcall->ref.ref(); pcall->setReplyCallback(receiver, returnMethod); diff --git a/src/dbus/qdbuspendingcall_p.h b/src/dbus/qdbuspendingcall_p.h index 46861ec..d797b5f 100644 --- a/src/dbus/qdbuspendingcall_p.h +++ b/src/dbus/qdbuspendingcall_p.h @@ -85,7 +85,6 @@ public: QList<int> metaTypes; int methodIdx; - bool autoDelete; // } mutable QMutex mutex; @@ -103,7 +102,7 @@ public: // } QDBusPendingCallPrivate(const QDBusMessage &sent, QDBusConnectionPrivate *connection) - : sentMessage(sent), connection(connection), autoDelete(false), watcherHelper(0), pending(0), waitingForFinished(false) + : sentMessage(sent), connection(connection), watcherHelper(0), pending(0), waitingForFinished(false) { } ~QDBusPendingCallPrivate(); bool setReplyCallback(QObject *target, const char *member); -- 1.8.3.1 ++++++ 0005-Change-QDBusPendingCallPrivate-to-full-reference-cou.patch ++++++
From 8234f5171a20628d6384d10a45d0437a0ab791ee Mon Sep 17 00:00:00 2001 From: Peter Seiderer <ps.report@gmx.net> Date: Mon, 17 Jun 2013 22:44:30 +0200 Subject: [PATCH 5/6] Change QDBusPendingCallPrivate to full reference counting for deletion.
Fixes race between QDBusConnectionPrivate::processFinishedCall() releasing the mutex before emitting signals (using various members of QDBusPendingCallPrivate) and deletion of the QDBusPendingCallPrivate object through QDBusPendingCall::d's destructor (a member of type QExplicitlySharedDataPointer<QDBusPendingCallPrivate>) leeds to segmentation fault with CrashTest example on slow/single core arm cpu). Task-number: QTBUG-27809 Change-Id: I3590d74d1cfa5816ede764b50b83a7008ec780ff (cherry-picked from qtbase commit 6c21f42657b494e24112c90d8b9fff719f1f8791) Reviewed-by: Peter Seiderer <ps.report@gmx.net> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> --- src/dbus/qdbusconnection.cpp | 3 +- src/dbus/qdbusconnection_p.h | 5 +-- src/dbus/qdbusintegrator.cpp | 87 ++++++++++++++++++++++++------------------- src/dbus/qdbuspendingcall.cpp | 6 +++ 4 files changed, 58 insertions(+), 43 deletions(-) diff --git a/src/dbus/qdbusconnection.cpp b/src/dbus/qdbusconnection.cpp index bb03c00..7ff09e9 100644 --- a/src/dbus/qdbusconnection.cpp +++ b/src/dbus/qdbusconnection.cpp @@ -53,6 +53,7 @@ #include "qdbusinterface_p.h" #include "qdbusutil_p.h" #include "qdbusconnectionmanager_p.h" +#include "qdbuspendingcall_p.h" #include "qdbusthreaddebug_p.h" @@ -625,7 +626,7 @@ QDBusPendingCall QDBusConnection::asyncCall(const QDBusMessage &message, int tim return QDBusPendingCall(0); // null pointer -> disconnected } - QDBusPendingCallPrivate *priv = d->sendWithReplyAsync(message, timeout); + QDBusPendingCallPrivate *priv = d->sendWithReplyAsync(message, 0, 0, 0, timeout); return QDBusPendingCall(priv); } diff --git a/src/dbus/qdbusconnection_p.h b/src/dbus/qdbusconnection_p.h index 04f22d3..e11997f 100644 --- a/src/dbus/qdbusconnection_p.h +++ b/src/dbus/qdbusconnection_p.h @@ -194,9 +194,8 @@ public: int send(const QDBusMessage &message); QDBusMessage sendWithReply(const QDBusMessage &message, int mode, int timeout = -1); QDBusMessage sendWithReplyLocal(const QDBusMessage &message); - QDBusPendingCallPrivate *sendWithReplyAsync(const QDBusMessage &message, int timeout = -1); - int sendWithReplyAsync(const QDBusMessage &message, QObject *receiver, - const char *returnMethod, const char *errorMethod, int timeout = -1); + QDBusPendingCallPrivate *sendWithReplyAsync(const QDBusMessage &message, QObject *receiver, + const char *returnMethod, const char *errorMethod,int timeout = -1); bool connectSignal(const QString &service, const QString &path, const QString& interface, const QString &name, const QStringList &argumentMatch, const QString &signature, QObject *receiver, const char *slot); diff --git a/src/dbus/qdbusintegrator.cpp b/src/dbus/qdbusintegrator.cpp index a91ba0e..081a947 100644 --- a/src/dbus/qdbusintegrator.cpp +++ b/src/dbus/qdbusintegrator.cpp @@ -1839,6 +1839,9 @@ void QDBusConnectionPrivate::processFinishedCall(QDBusPendingCallPrivate *call) if (msg.type() == QDBusMessage::ErrorMessage) emit connection->callWithCallbackFailed(QDBusError(msg), call->sentMessage); + + if (!call->ref.deref()) + delete call; } int QDBusConnectionPrivate::send(const QDBusMessage& message) @@ -1921,7 +1924,7 @@ QDBusMessage QDBusConnectionPrivate::sendWithReply(const QDBusMessage &message, return amsg; } else { // use the event loop - QDBusPendingCallPrivate *pcall = sendWithReplyAsync(message, timeout); + QDBusPendingCallPrivate *pcall = sendWithReplyAsync(message, 0, 0, 0, timeout); Q_ASSERT(pcall); if (pcall->replyMessage.type() == QDBusMessage::InvalidMessage) { @@ -1937,6 +1940,10 @@ QDBusMessage QDBusConnectionPrivate::sendWithReply(const QDBusMessage &message, QDBusMessage reply = pcall->replyMessage; lastError = reply; // set or clear error + bool r = pcall->ref.deref(); + Q_ASSERT(!r); + Q_UNUSED(r); + delete pcall; return reply; } @@ -1976,19 +1983,55 @@ QDBusMessage QDBusConnectionPrivate::sendWithReplyLocal(const QDBusMessage &mess } QDBusPendingCallPrivate *QDBusConnectionPrivate::sendWithReplyAsync(const QDBusMessage &message, - int timeout) + QObject *receiver, const char *returnMethod, + const char *errorMethod, int timeout) { if (isServiceRegisteredByThread(message.service())) { // special case for local calls QDBusPendingCallPrivate *pcall = new QDBusPendingCallPrivate(message, this); pcall->replyMessage = sendWithReplyLocal(message); + if (receiver && returnMethod) + pcall->setReplyCallback(receiver, returnMethod); + + if (errorMethod) { + pcall->watcherHelper = new QDBusPendingCallWatcherHelper; + connect(pcall->watcherHelper, SIGNAL(error(QDBusError,QDBusMessage)), receiver, errorMethod, + Qt::QueuedConnection); + pcall->watcherHelper->moveToThread(thread()); + } + if ((receiver && returnMethod) || errorMethod) { + // no one waiting, will delete pcall in processFinishedCall() + pcall->ref = 1; + } else { + // set double ref to prevent race between processFinishedCall() and ref counting + // by QDBusPendingCall::QExplicitlySharedDataPointer<QDBusPendingCallPrivate> + pcall->ref = 2; + } + processFinishedCall(pcall); return pcall; } checkThread(); QDBusPendingCallPrivate *pcall = new QDBusPendingCallPrivate(message, this); - pcall->ref = 0; + if (receiver && returnMethod) + pcall->setReplyCallback(receiver, returnMethod); + + if (errorMethod) { + pcall->watcherHelper = new QDBusPendingCallWatcherHelper; + connect(pcall->watcherHelper, SIGNAL(error(QDBusError,QDBusMessage)), receiver, errorMethod, + Qt::QueuedConnection); + pcall->watcherHelper->moveToThread(thread()); + } + + if ((receiver && returnMethod) || errorMethod) { + // no one waiting, will delete pcall in processFinishedCall() + pcall->ref = 1; + } else { + // set double ref to prevent race between processFinishedCall() and ref counting + // by QDBusPendingCall::QExplicitlySharedDataPointer<QDBusPendingCallPrivate> + pcall->ref = 2; + } QDBusError error; DBusMessage *msg = QDBusMessagePrivate::toDBusMessage(message, capabilities, &error); @@ -1999,6 +2042,7 @@ QDBusPendingCallPrivate *QDBusConnectionPrivate::sendWithReplyAsync(const QDBusM qPrintable(error.message())); pcall->replyMessage = QDBusMessage::createError(error); lastError = error; + processFinishedCall(pcall); return pcall; } @@ -2024,45 +2068,10 @@ QDBusPendingCallPrivate *QDBusConnectionPrivate::sendWithReplyAsync(const QDBusM q_dbus_message_unref(msg); pcall->replyMessage = QDBusMessage::createError(error); + processFinishedCall(pcall); return pcall; } -int QDBusConnectionPrivate::sendWithReplyAsync(const QDBusMessage &message, QObject *receiver, - const char *returnMethod, const char *errorMethod, - int timeout) -{ - QDBusPendingCallPrivate *pcall = sendWithReplyAsync(message, timeout); - Q_ASSERT(pcall); - - // has it already finished with success (dispatched locally)? - if (pcall->replyMessage.type() == QDBusMessage::ReplyMessage) { - pcall->setReplyCallback(receiver, returnMethod); - processFinishedCall(pcall); - delete pcall; - return 1; - } - - // either it hasn't finished or it has finished with error - if (errorMethod) { - pcall->watcherHelper = new QDBusPendingCallWatcherHelper; - connect(pcall->watcherHelper, SIGNAL(error(QDBusError,QDBusMessage)), receiver, errorMethod, - Qt::QueuedConnection); - pcall->watcherHelper->moveToThread(thread()); - } - - // has it already finished and is an error reply message? - if (pcall->replyMessage.type() == QDBusMessage::ErrorMessage) { - processFinishedCall(pcall); - delete pcall; - return 1; - } - - pcall->ref.ref(); - pcall->setReplyCallback(receiver, returnMethod); - - return 1; -} - bool QDBusConnectionPrivate::connectSignal(const QString &service, const QString &path, const QString &interface, const QString &name, const QStringList &argumentMatch, const QString &signature, diff --git a/src/dbus/qdbuspendingcall.cpp b/src/dbus/qdbuspendingcall.cpp index 5485a4b..56cf45a 100644 --- a/src/dbus/qdbuspendingcall.cpp +++ b/src/dbus/qdbuspendingcall.cpp @@ -260,6 +260,11 @@ QDBusPendingCall::QDBusPendingCall(const QDBusPendingCall &other) QDBusPendingCall::QDBusPendingCall(QDBusPendingCallPrivate *dd) : d(dd) { + if (dd) { + bool r = dd->ref.deref(); + Q_ASSERT(r); + Q_UNUSED(r); + } } /*! @@ -465,6 +470,7 @@ QDBusPendingCall QDBusPendingCall::fromCompletedCall(const QDBusMessage &msg) msg.type() == QDBusMessage::ReplyMessage) { d = new QDBusPendingCallPrivate(QDBusMessage(), 0); d->replyMessage = msg; + d->ref = 1; } return QDBusPendingCall(d); -- 1.8.3.1 ++++++ libqt4-devel-doc.spec.in ++++++ --- /var/tmp/diff_new_pack.mJHxHi/_old 2013-09-02 15:00:19.000000000 +0200 +++ /var/tmp/diff_new_pack.mJHxHi/_new 2013-09-02 15:00:19.000000000 +0200 @@ -17,7 +17,7 @@ # nodebuginfo Name: libqt4-devel-doc -BuildRequires: Mesa-devel +BuildRequires: pkgconfig(gl) BuildRequires: alsa-devel BuildRequires: cups-devel BuildRequires: fdupes ++++++ libqt4-sql-plugins.spec.in ++++++ --- /var/tmp/diff_new_pack.mJHxHi/_old 2013-09-02 15:00:20.000000000 +0200 +++ /var/tmp/diff_new_pack.mJHxHi/_new 2013-09-02 15:00:20.000000000 +0200 @@ -17,7 +17,7 @@ # nodebuginfo Name: libqt4-sql-plugins -BuildRequires: Mesa-devel +BuildRequires: pkgconfig(gl) BuildRequires: alsa-devel BuildRequires: cups-devel BuildRequires: gtk2-devel -- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org
participants (1)
-
root@hilbert.suse.de