qt5base-lts/src/dbus
Peter Seiderer 72ecf5a7ec 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
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2013-07-29 22:28:41 +02:00
..
doc Doc: Removed pages from "technology-apis" group. 2013-05-27 02:45:21 +02:00
dbus.pro Improve support for <MODULE>_PATH options 2013-05-10 19:39:53 +02:00
qdbus_symbols_p.h Stop using function deprecated in D-Bus 1.2 (raise minimum version) 2013-02-27 07:09:03 +01:00
qdbus_symbols.cpp Update copyright year in Digia's license headers 2013-01-18 09:07:35 +01:00
qdbusabstractadaptor_p.h Update copyright year in Digia's license headers 2013-01-18 09:07:35 +01:00
qdbusabstractadaptor.cpp Don't crash if the relayed signal was emitted from the wrong thread 2013-07-03 01:24:12 +02:00
qdbusabstractadaptor.h Remove QT_{BEGIN,END}_HEADER macro usage 2013-01-29 01:06:04 +01:00
qdbusabstractinterface_p.h Update copyright year in Digia's license headers 2013-01-18 09:07:35 +01:00
qdbusabstractinterface.cpp Fix QDBusAbstractInterface::isValid() for peer connections 2013-07-16 18:32:14 +02:00
qdbusabstractinterface.h Remove QT_{BEGIN,END}_HEADER macro usage 2013-01-29 01:06:04 +01:00
qdbusargument_p.h Update copyright year in Digia's license headers 2013-01-18 09:07:35 +01:00
qdbusargument.cpp Doc: Removed reference to deprecated \badcode command. 2013-02-19 11:55:51 +01:00
qdbusargument.h Remove QT_{BEGIN,END}_HEADER macro usage 2013-01-29 01:06:04 +01:00
qdbusconnection_p.h don't bootstrap tools when not necessary 2013-03-14 19:49:38 +01:00
qdbusconnection.cpp Merge remote-tracking branch 'origin/stable' into dev 2013-01-28 11:10:29 +01:00
qdbusconnection.h Remove QT_{BEGIN,END}_HEADER macro usage 2013-01-29 01:06:04 +01:00
qdbusconnectioninterface.cpp Update copyright year in Digia's license headers 2013-01-18 09:07:35 +01:00
qdbusconnectioninterface.h Remove QT_{BEGIN,END}_HEADER macro usage 2013-01-29 01:06:04 +01:00
qdbusconnectionmanager_p.h Update copyright year in Digia's license headers 2013-01-18 09:07:35 +01:00
qdbuscontext_p.h Update copyright year in Digia's license headers 2013-01-18 09:07:35 +01:00
qdbuscontext.cpp Doc: Fix module name format 2013-01-25 17:27:44 +01:00
qdbuscontext.h Remove QT_{BEGIN,END}_HEADER macro usage 2013-01-29 01:06:04 +01:00
qdbusdemarshaller.cpp Update copyright year in Digia's license headers 2013-01-18 09:07:35 +01:00
qdbuserror.cpp Mark as unused the private members that aren't and CANNOT be used 2013-04-15 15:32:40 +02:00
qdbuserror.h Remove QT_{BEGIN,END}_HEADER macro usage 2013-01-29 01:06:04 +01:00
qdbusextratypes.cpp Doc: Fix module name format 2013-01-25 17:27:44 +01:00
qdbusextratypes.h Remove QT_{BEGIN,END}_HEADER macro usage 2013-01-29 01:06:04 +01:00
qdbusintegrator_p.h Fix change-of-sign warning found by ICC 2013-02-02 10:35:22 +01:00
qdbusintegrator.cpp Remove QDBusPendingCallPrivate::autoDelete logic. 2013-07-29 22:28:41 +02:00
qdbusinterface_p.h Update copyright year in Digia's license headers 2013-01-18 09:07:35 +01:00
qdbusinterface.cpp Doc: Fix module name format 2013-01-25 17:27:44 +01:00
qdbusinterface.h Remove QT_{BEGIN,END}_HEADER macro usage 2013-01-29 01:06:04 +01:00
qdbusinternalfilters.cpp Update copyright year in Digia's license headers 2013-01-18 09:07:35 +01:00
qdbusintrospection_p.h Whitespace cleanup: remove trailing whitespace 2013-03-16 20:22:50 +01:00
qdbusintrospection.cpp Update copyright year in Digia's license headers 2013-01-18 09:07:35 +01:00
qdbusmacros.h Remove QT_{BEGIN,END}_HEADER macro usage 2013-01-29 01:06:04 +01:00
qdbusmarshaller.cpp Update copyright year in Digia's license headers 2013-01-18 09:07:35 +01:00
qdbusmessage_p.h Update copyright year in Digia's license headers 2013-01-18 09:07:35 +01:00
qdbusmessage.cpp Doc: Fix module name format 2013-01-25 17:27:44 +01:00
qdbusmessage.h Merge remote-tracking branch 'origin/stable' into dev 2013-02-14 14:24:57 +01:00
qdbusmetaobject_p.h Update copyright year in Digia's license headers 2013-01-18 09:07:35 +01:00
qdbusmetaobject.cpp Whitespace cleanup: remove trailing whitespace 2013-03-16 20:22:50 +01:00
qdbusmetatype_p.h Update copyright year in Digia's license headers 2013-01-18 09:07:35 +01:00
qdbusmetatype.cpp Whitespace cleanup: remove trailing whitespace 2013-03-16 20:22:50 +01:00
qdbusmetatype.h Remove QT_{BEGIN,END}_HEADER macro usage 2013-01-29 01:06:04 +01:00
qdbusmisc.cpp Update copyright year in Digia's license headers 2013-01-18 09:07:35 +01:00
qdbuspendingcall_p.h Remove QDBusPendingCallPrivate::autoDelete logic. 2013-07-29 22:28:41 +02:00
qdbuspendingcall.cpp Update copyright year in Digia's license headers 2013-01-18 09:07:35 +01:00
qdbuspendingcall.h Remove QT_{BEGIN,END}_HEADER macro usage 2013-01-29 01:06:04 +01:00
qdbuspendingreply.cpp Merge remote-tracking branch 'origin/stable' into dev 2013-01-22 18:40:13 +01:00
qdbuspendingreply.h Make sure we don't have an operator void(), ICC doesn't like it. 2013-02-02 10:35:22 +01:00
qdbusreply.cpp Update copyright year in Digia's license headers 2013-01-18 09:07:35 +01:00
qdbusreply.h Add QDBusReply::error() const. 2013-03-01 09:39:23 +01:00
qdbusserver.cpp Update copyright year in Digia's license headers 2013-01-18 09:07:35 +01:00
qdbusserver.h Remove QT_{BEGIN,END}_HEADER macro usage 2013-01-29 01:06:04 +01:00
qdbusservicewatcher.cpp Update copyright year in Digia's license headers 2013-01-18 09:07:35 +01:00
qdbusservicewatcher.h Remove QT_{BEGIN,END}_HEADER macro usage 2013-01-29 01:06:04 +01:00
qdbusthreaddebug_p.h Update copyright year in Digia's license headers 2013-01-18 09:07:35 +01:00
qdbusunixfiledescriptor.cpp Fix module name in license headers. 2013-05-10 17:00:40 +02:00
qdbusunixfiledescriptor.h Fix module name in license headers. 2013-05-10 17:00:40 +02:00
qdbusutil_p.h Remove QT_{BEGIN,END}_HEADER macro usage 2013-01-29 01:06:04 +01:00
qdbusutil.cpp Remove use of 'register' from Qt. 2013-06-17 09:44:22 +02:00
qdbusvirtualobject.cpp Make the QDBusVirtualObject docs public. 2013-03-15 21:38:31 +01:00
qdbusvirtualobject.h Remove QT_{BEGIN,END}_HEADER macro usage 2013-01-29 01:06:04 +01:00
qdbusxmlgenerator.cpp Changed digia contact details to */legal, updated licenses 2013-07-20 11:21:46 +02:00
qdbusxmlparser_p.h Update copyright year in Digia's license headers 2013-01-18 09:07:35 +01:00
qdbusxmlparser.cpp Update copyright year in Digia's license headers 2013-01-18 09:07:35 +01:00
Qt5DBusConfigExtras.cmake.in Check that files we expect to find actually exist when using a cmake package. 2013-05-20 15:20:26 +02:00
Qt5DBusMacros.cmake Create IMPORTED CMake targets for executables. 2012-07-25 13:59:15 +02:00