Hello community, here is the log from the commit of package threadweaver for openSUSE:Factory checked in at 2014-05-14 20:27:32 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/threadweaver (Old) and /work/SRC/openSUSE:Factory/.threadweaver.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "threadweaver" Changes: -------- --- /work/SRC/openSUSE:Factory/threadweaver/threadweaver.changes 2014-04-02 17:22:49.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.threadweaver.new/threadweaver.changes 2014-05-14 20:28:24.000000000 +0200 @@ -1,0 +2,9 @@ +Sun May 4 01:41:29 UTC 2014 - [email protected] + +- Update to 4.99.0 + * API improvements and cleanups + * Buildsystem fixes + * For more details please see: + http://www.kde.org/announcements/announce-frameworks5-beta2.php + +------------------------------------------------------------------- Old: ---- threadweaver-4.98.0.tar.xz New: ---- threadweaver-4.99.0.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ threadweaver.spec ++++++ --- /var/tmp/diff_new_pack.DzayfD/_old 2014-05-14 20:28:24.000000000 +0200 +++ /var/tmp/diff_new_pack.DzayfD/_new 2014-05-14 20:28:24.000000000 +0200 @@ -18,10 +18,10 @@ %define lname libKF5ThreadWeaver5 Name: threadweaver -Version: 4.98.0 +Version: 4.99.0 Release: 0 BuildRequires: cmake >= 2.8.12 -BuildRequires: extra-cmake-modules >= 0.0.12 +BuildRequires: extra-cmake-modules >= 0.0.13 BuildRequires: fdupes BuildRequires: kf5-filesystem BuildRequires: pkgconfig(Qt5Core) >= 5.2.0 ++++++ threadweaver-4.98.0.tar.xz -> threadweaver-4.99.0.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/threadweaver-4.98.0/CMakeLists.txt new/threadweaver-4.99.0/CMakeLists.txt --- old/threadweaver-4.98.0/CMakeLists.txt 2014-03-28 19:17:54.000000000 +0100 +++ new/threadweaver-4.99.0/CMakeLists.txt 2014-05-04 21:03:33.000000000 +0200 @@ -2,7 +2,7 @@ project(ThreadWeaver) -find_package(ECM 0.0.12 REQUIRED NO_MODULE) +find_package(ECM 0.0.13 REQUIRED NO_MODULE) set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR}) @@ -20,8 +20,12 @@ include(ECMSetupVersion) include(ECMGenerateHeaders) +IF(THREADWEAVER_USE_GNU_CXX11) + ADD_DEFINITIONS(-std=c++11) +ENDIF() + # -- Maintained by scripty -set(KF5_VERSION "4.98.0") +set(KF5_VERSION "4.99.0") # handled by release scripts ecm_setup_version(${KF5_VERSION} VARIABLE_PREFIX THREADWEAVER VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/threadweaver_version.h" @@ -44,7 +48,7 @@ ) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/threadweaver_version.h - DESTINATION ${INCLUDE_INSTALL_DIR} COMPONENT Devel ) + DESTINATION ${KF5_INCLUDE_INSTALL_DIR} COMPONENT Devel ) install(FILES "${CMAKE_CURRENT_BINARY_DIR}/KF5ThreadWeaverConfig.cmake" @@ -55,6 +59,4 @@ install(EXPORT KF5ThreadWeaverTargets DESTINATION "${CMAKECONFIG_INSTALL_DIR}" FILE KF5ThreadWeaverTargets.cmake NAMESPACE KF5:: ) -if ("${CMAKE_BINARY_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}") - feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES) -endif() +feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/threadweaver-4.98.0/autotests/AppendCharacterJob.h new/threadweaver-4.99.0/autotests/AppendCharacterJob.h --- old/threadweaver-4.98.0/autotests/AppendCharacterJob.h 2014-03-28 19:17:54.000000000 +0100 +++ new/threadweaver-4.99.0/autotests/AppendCharacterJob.h 2014-05-04 21:03:33.000000000 +0200 @@ -87,9 +87,10 @@ { } - bool success() const + void run(ThreadWeaver::JobPointer job, ThreadWeaver::Thread* thread) { - return false; + AppendCharacterJob::run(job, thread); + setStatus(Job::Status_Failed); } }; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/threadweaver-4.98.0/autotests/CMakeLists.txt new/threadweaver-4.99.0/autotests/CMakeLists.txt --- old/threadweaver-4.98.0/autotests/CMakeLists.txt 2014-03-28 19:17:54.000000000 +0100 +++ new/threadweaver-4.99.0/autotests/CMakeLists.txt 2014-05-04 21:03:33.000000000 +0200 @@ -18,6 +18,17 @@ ########### next target ############### +set(SequencesTests_SRCS SequencesTests.cpp WaitForIdleAndFinished.cpp) + +add_executable(ThreadWeaverSequencesTests ${SequencesTests_SRCS}) +add_test(ThreadWeaverSequencesTests ThreadWeaverSequencesTests) +ecm_mark_as_test(ThreadWeaverSequencesTests) + +target_link_libraries(ThreadWeaverSequencesTests Qt5::Test KF5::ThreadWeaver) +set_target_properties(ThreadWeaverSequencesTests PROPERTIES MACOSX_BUNDLE FALSE) + +########### next target ############### + set(QueueTests_SRCS QueueTests.cpp) add_executable(ThreadWeaverQueueTests ${QueueTests_SRCS}) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/threadweaver-4.98.0/autotests/DeleteTest.cpp new/threadweaver-4.99.0/autotests/DeleteTest.cpp --- old/threadweaver-4.98.0/autotests/DeleteTest.cpp 2014-03-28 19:17:54.000000000 +0100 +++ new/threadweaver-4.99.0/autotests/DeleteTest.cpp 2014-05-04 21:03:33.000000000 +0200 @@ -146,6 +146,16 @@ QCOMPARE(InstanceCountingBusyJob::instances(), 0); } +void DeleteTest::MutexLockingAssertsTest() +{ + QMutex mutex; + MUTEX_ASSERT_UNLOCKED(&mutex); + mutex.lock(); + MUTEX_ASSERT_LOCKED(&mutex); + mutex.unlock(); + MUTEX_ASSERT_UNLOCKED(&mutex); +} + void DeleteTest::DeleteCollectionTest() { const int NumberOfCollections = 100; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/threadweaver-4.98.0/autotests/DeleteTest.h new/threadweaver-4.99.0/autotests/DeleteTest.h --- old/threadweaver-4.98.0/autotests/DeleteTest.h 2014-03-28 19:17:54.000000000 +0100 +++ new/threadweaver-4.99.0/autotests/DeleteTest.h 2014-05-04 21:03:33.000000000 +0200 @@ -49,6 +49,7 @@ private Q_SLOTS: void DeleteJobsTest(); + void MutexLockingAssertsTest(); void DeleteCollectionTest(); void DeleteDecoratedCollectionTest(); void DeleteSequenceTest(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/threadweaver-4.98.0/autotests/SequencesTests.cpp new/threadweaver-4.99.0/autotests/SequencesTests.cpp --- old/threadweaver-4.98.0/autotests/SequencesTests.cpp 1970-01-01 01:00:00.000000000 +0100 +++ new/threadweaver-4.99.0/autotests/SequencesTests.cpp 2014-05-04 21:03:33.000000000 +0200 @@ -0,0 +1,70 @@ +/* -*- C++ -*- + + This file contains a testsuite for sequences in ThreadWeaver. + + $ Author: Mirko Boehm $ + $ Copyright: (C) 2005-2013 Mirko Boehm $ + $ Contact: [email protected] + http://www.kde.org + http://creative-destruction.me $ + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include <QString> +#include <QtTest> +#include <QCoreApplication> + +#include <ThreadWeaver/ThreadWeaver> +#include <ThreadWeaver/DebuggingAids> + +#include "JobLoggingWeaver.h" +#include "WaitForIdleAndFinished.h" +#include "AppendCharacterJob.h" +#include "SequencesTests.h" + +using namespace ThreadWeaver; + +QMutex s_GlobalMutex; + +SequencesTests::SequencesTests() +{ + setDebugLevel(true, 1); +} + +void SequencesTests::RecursiveStopTest() +{ + // auto logger = new JobLoggingWeaver(); + // Queue queue(logger); + Queue queue; + WAITFORIDLEANDFINISHED(&queue); + QString result; + Sequence innerSequence; + innerSequence << new AppendCharacterJob('b', &result) + << new FailingAppendCharacterJob('c', &result) + << new AppendCharacterJob('d', &result); + + Sequence outerSequence; + outerSequence << new AppendCharacterJob('a', &result) + << innerSequence + << new AppendCharacterJob('e', &result); + + queue.stream() << outerSequence; + queue.finish(); + QCOMPARE(result, QString::fromLatin1("abc")); +} + +QTEST_MAIN(SequencesTests); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/threadweaver-4.98.0/autotests/SequencesTests.h new/threadweaver-4.99.0/autotests/SequencesTests.h --- old/threadweaver-4.98.0/autotests/SequencesTests.h 1970-01-01 01:00:00.000000000 +0100 +++ new/threadweaver-4.99.0/autotests/SequencesTests.h 2014-05-04 21:03:33.000000000 +0200 @@ -0,0 +1,43 @@ +/* -*- C++ -*- + + This file contains a testsuite for sequences in ThreadWeaver. + + $ Author: Mirko Boehm $ + $ Copyright: (C) 2005-2013 Mirko Boehm $ + $ Contact: [email protected] + http://www.kde.org + http://creative-destruction.me $ + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef SEQUENCESTESTS_H +#define SEQUENCESTESTS_H + +#include <QObject> + +class SequencesTests : public QObject +{ + Q_OBJECT + +public: + SequencesTests(); + +private Q_SLOTS: + void RecursiveStopTest(); +}; + +#endif // SEQUENCESTESTS_H diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/threadweaver-4.98.0/autotests/WaitForIdleAndFinished.h new/threadweaver-4.99.0/autotests/WaitForIdleAndFinished.h --- old/threadweaver-4.98.0/autotests/WaitForIdleAndFinished.h 2014-03-28 19:17:54.000000000 +0100 +++ new/threadweaver-4.99.0/autotests/WaitForIdleAndFinished.h 2014-05-04 21:03:33.000000000 +0200 @@ -44,4 +44,8 @@ ThreadWeaver::Queue *weaver_; }; +/** @brief Create a WaitForIdleAndFinished, and supress the IDE unused warning. */ +#define WAITFORIDLEANDFINISHED(queue) const WaitForIdleAndFinished waitForIdleAndFinished##__LINE__(queue);\ + Q_UNUSED(waitForIdleAndFinished##__LINE__); + #endif // WAITFORIDLEANDFINISHED_H diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/threadweaver-4.98.0/metainfo.yaml new/threadweaver-4.99.0/metainfo.yaml --- old/threadweaver-4.98.0/metainfo.yaml 1970-01-01 01:00:00.000000000 +0100 +++ new/threadweaver-4.99.0/metainfo.yaml 2014-05-04 21:03:33.000000000 +0200 @@ -0,0 +1,9 @@ +maintainer: mirko +description: High-level multithreading framework +tier: 1 +type: functional +platforms: + - name: All +portingAid: false +deprecated: false +release: true diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/threadweaver-4.98.0/src/CMakeLists.txt new/threadweaver-4.99.0/src/CMakeLists.txt --- old/threadweaver-4.98.0/src/CMakeLists.txt 2014-03-28 19:17:54.000000000 +0100 +++ new/threadweaver-4.99.0/src/CMakeLists.txt 2014-05-04 21:03:33.000000000 +0200 @@ -39,9 +39,8 @@ add_library(KF5::ThreadWeaver ALIAS KF5ThreadWeaver) target_link_libraries(KF5ThreadWeaver PUBLIC Qt5::Core) target_include_directories(KF5ThreadWeaver PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/..;${CMAKE_CURRENT_BINARY_DIR}>") -target_include_directories(KF5ThreadWeaver INTERFACE "$<INSTALL_INTERFACE:${INCLUDE_INSTALL_DIR}/ThreadWeaver>") +target_include_directories(KF5ThreadWeaver INTERFACE "$<INSTALL_INTERFACE:${KF5_INCLUDE_INSTALL_DIR}/ThreadWeaver>") #FIXME: make this PUBLIC, so that it applies to anything that links against -# KF5::ThreadWeaver? kde_target_enable_exceptions(KF5ThreadWeaver PRIVATE) set_target_properties(KF5ThreadWeaver PROPERTIES @@ -49,7 +48,7 @@ SOVERSION ${THREADWEAVER_SOVERSION} EXPORT_NAME ThreadWeaver ) -install(TARGETS KF5ThreadWeaver EXPORT KF5ThreadWeaverTargets ${INSTALL_TARGETS_DEFAULT_ARGS}) +install(TARGETS KF5ThreadWeaver EXPORT KF5ThreadWeaverTargets ${KF5_INSTALL_TARGETS_DEFAULT_ARGS}) ecm_generate_headers(ThreadWeaver_CamelCase_HEADERS HEADER_NAMES @@ -90,14 +89,14 @@ PREFIX ThreadWeaver REQUIRED_HEADERS ThreadWeaver_HEADERS ) -install(FILES ${ThreadWeaver_CamelCase_HEADERS} DESTINATION ${INCLUDE_INSTALL_DIR}/ThreadWeaver/ThreadWeaver COMPONENT Devel) +install(FILES ${ThreadWeaver_CamelCase_HEADERS} DESTINATION ${KF5_INCLUDE_INSTALL_DIR}/ThreadWeaver/ThreadWeaver COMPONENT Devel) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/threadweaver_export.h ${ThreadWeaver_HEADERS} - DESTINATION ${INCLUDE_INSTALL_DIR}/ThreadWeaver/threadweaver COMPONENT Devel + DESTINATION ${KF5_INCLUDE_INSTALL_DIR}/ThreadWeaver/threadweaver COMPONENT Devel ) include(ECMGeneratePriFile) -ecm_generate_pri_file(BASE_NAME ThreadWeaver LIB_NAME KF5ThreadWeaver DEPS "core" FILENAME_VAR PRI_FILENAME) +ecm_generate_pri_file(BASE_NAME ThreadWeaver LIB_NAME KF5ThreadWeaver DEPS "core" FILENAME_VAR PRI_FILENAME INCLUDE_INSTALL_DIR ${KF5_INCLUDE_INSTALL_DIR}/ThreadWeaver) install(FILES ${PRI_FILENAME} DESTINATION ${ECM_MKSPECS_INSTALL_DIR}) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/threadweaver-4.98.0/src/collection.cpp new/threadweaver-4.99.0/src/collection.cpp --- old/threadweaver-4.98.0/src/collection.cpp 2014-03-28 19:17:54.000000000 +0100 +++ new/threadweaver-4.99.0/src/collection.cpp 2014-05-04 21:03:33.000000000 +0200 @@ -91,6 +91,7 @@ Collection::~Collection() { + MUTEX_ASSERT_UNLOCKED(mutex()); // dequeue all remaining jobs: QMutexLocker l(mutex()); Q_UNUSED(l); if (d()->api != 0) { // still queued diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/threadweaver-4.98.0/src/collection_p.cpp new/threadweaver-4.99.0/src/collection_p.cpp --- old/threadweaver-4.98.0/src/collection_p.cpp 2014-03-28 19:17:54.000000000 +0100 +++ new/threadweaver-4.99.0/src/collection_p.cpp 2014-05-04 21:03:33.000000000 +0200 @@ -50,7 +50,9 @@ Q_ASSERT(!self.isNull()); Q_ASSERT(!mutex.tryLock()); freeQueuePolicyResources(self); - collection->setStatus(Job::Status_Success); + if (collection->status() < Job::Status_Success) { + collection->setStatus(Job::Status_Success); + } api = 0; } @@ -73,8 +75,17 @@ } } +namespace { +struct MutexUnlocker { + QMutexLocker* locker; + MutexUnlocker(QMutexLocker* l) : locker(l) { locker->unlock(); } + ~MutexUnlocker() { locker->relock(); } +}; +} + void Collection_Private::elementFinished(Collection *collection, JobPointer job, Thread *thread) { + JobPointer saveYourSelf = self; Q_UNUSED(saveYourSelf); QMutexLocker l(&mutex); Q_UNUSED(l); Q_ASSERT(!self.isNull()); Q_UNUSED(job) // except in Q_ASSERT @@ -87,9 +98,9 @@ } const int started = jobsStarted.loadAcquire(); Q_ASSERT(started >= 0); Q_UNUSED(started); + processCompletedElement(collection, job, thread); const int remainingJobs = jobCounter.fetchAndAddOrdered(-1) - 1; TWDEBUG(4, "Collection_Private::elementFinished: %i\n", remainingJobs); - processCompletedElement(collection, job, thread); if (remainingJobs <= -1) { //its no use to count, the elements have been dequeued, now the threads call back that have been processing jobs in the meantime } else { @@ -99,8 +110,10 @@ // there is a small chance that (this) has been dequeued in the // meantime, in this case, there is nothing left to clean up finalCleanup(collection); - selfExecuteWrapper.callEnd(); - l.unlock(); + { + MutexUnlocker u(&l); Q_UNUSED(u); + selfExecuteWrapper.callEnd(); + } self.clear(); } } @@ -136,20 +149,23 @@ } for (int index = 0; index < elements.size(); ++index) { - TWDEBUG(4, "Collection::Private::dequeueElements: dequeueing %p.\n", (void *)elements.at(index).data()); + bool result; if (queueApiIsLocked) { - api->dequeue_p(elements.at(index)); + result = api->dequeue_p(elements.at(index)); } else { - api->dequeue(elements.at(index)); + result = api->dequeue(elements.at(index)); + } + if (result) { + jobCounter.fetchAndAddOrdered(-1); } + TWDEBUG(3, "Collection::Private::dequeueElements: dequeueing %p (%s, %i jobs left).\n", + (void *)elements.at(index).data(), + result ? "found" : "not found", + jobCounter.loadAcquire()); elementDequeued(elements.at(index)); } - const int jobCount = jobCounter.fetchAndStoreAcquire(-1); - if (jobCount != 0) { - // if jobCounter is not zero, then we where waiting for the - // last job to finish before we would have freed our queue - // policies. In this case we have to do it here: + if (jobCounter.loadAcquire() == 1) { finalCleanup(collection); } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/threadweaver-4.98.0/src/debuggingaids.cpp new/threadweaver-4.99.0/src/debuggingaids.cpp --- old/threadweaver-4.98.0/src/debuggingaids.cpp 2014-03-28 19:17:54.000000000 +0100 +++ new/threadweaver-4.99.0/src/debuggingaids.cpp 2014-05-04 21:03:33.000000000 +0200 @@ -36,4 +36,23 @@ Generally, you should not use it in your own code. */ THREADWEAVER_EXPORT QMutex ThreadWeaver::GlobalMutex; THREADWEAVER_EXPORT bool ThreadWeaver::Debug = true; -THREADWEAVER_EXPORT int ThreadWeaver::DebugLevel = 01; +THREADWEAVER_EXPORT int ThreadWeaver::DebugLevel = 1; + +namespace ThreadWeaver { + +void mutexAssertUnlocked(QMutex* mutex, const char* where) { + if (mutex->tryLock()) { + mutex->unlock(); + } else { + Q_ASSERT_X(false, where, "mutexAssertUnlocked: mutex was locked!"); + } +} + +void mutexAssertLocked(QMutex* mutex, const char* where) { + if (mutex->tryLock()) { + mutex->unlock(); + Q_ASSERT_X(false, where, "mutexAssertUnlocked: mutex was locked!"); + } +} + +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/threadweaver-4.98.0/src/debuggingaids.h new/threadweaver-4.99.0/src/debuggingaids.h --- old/threadweaver-4.98.0/src/debuggingaids.h 2014-03-28 19:17:54.000000000 +0100 +++ new/threadweaver-4.99.0/src/debuggingaids.h 2014-05-04 21:03:33.000000000 +0200 @@ -110,8 +110,6 @@ #ifndef QT_NO_DEBUG -//#error Get out! - #define TWDEBUG(...) ThreadWeaver::threadweaver_debug(__VA_ARGS__) inline void threadweaver_debug(int severity, const char *cformat, ...) { @@ -140,6 +138,18 @@ #define TWDEBUG(...) #endif +// Macros to ensure that mutexes are locked or unlocked: +void THREADWEAVER_EXPORT mutexAssertUnlocked(QMutex* mutex, const char* where); +void THREADWEAVER_EXPORT mutexAssertLocked(QMutex* mutex, const char* where); + +#ifndef QT_NO_DEBUG +#define MUTEX_ASSERT_UNLOCKED(x) mutexAssertUnlocked(x, Q_FUNC_INFO) +#define MUTEX_ASSERT_LOCKED(x) mutexAssertLocked(x, Q_FUNC_INFO) +#else +#define MUTEX_ASSERT_UNLOCKED(x) +#define MUTEX_ASSERT_LOCKED(x) +#endif + inline bool invariant() { return true; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/threadweaver-4.98.0/src/sequence_p.cpp new/threadweaver-4.99.0/src/sequence_p.cpp --- old/threadweaver-4.98.0/src/sequence_p.cpp 2014-03-28 19:17:54.000000000 +0100 +++ new/threadweaver-4.99.0/src/sequence_p.cpp 2014-05-04 21:03:33.000000000 +0200 @@ -60,8 +60,10 @@ Q_ASSERT(!mutex.tryLock()); Q_ASSERT(job != 0); Q_ASSERT(!self.isNull()); - if (!job->success()) { + const JobInterface::Status status = job->status(); + if (status != JobInterface::Status_Success) { stop_locked(collection); + collection->setStatus(status); } const int next = completed_.fetchAndAddAcquire(1); const int count = elements.count(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/threadweaver-4.98.0/src/thread.cpp new/threadweaver-4.99.0/src/thread.cpp --- old/threadweaver-4.98.0/src/thread.cpp 2014-03-28 19:17:54.000000000 +0100 +++ new/threadweaver-4.99.0/src/thread.cpp 2014-05-04 21:03:33.000000000 +0200 @@ -107,8 +107,14 @@ wasBusy = true; d->job->execute(d->job, this); - QMutexLocker l(&d->mutex); Q_UNUSED(l); - d->job.clear(); + JobPointer oldJob; + { // When finally destroying the last reference to d->job, do not hold the mutex. + // It may trigger destruction of the job, which can execute arbitrary code. + QMutexLocker l(&d->mutex); Q_UNUSED(l); + oldJob = d->job; + d->job.clear(); + } + oldJob.clear(); } TWDEBUG(3, "Thread::run [%u]: exiting.\n", id()); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/threadweaver-4.98.0/threadweaver.yaml new/threadweaver-4.99.0/threadweaver.yaml --- old/threadweaver-4.98.0/threadweaver.yaml 2014-03-28 19:17:54.000000000 +0100 +++ new/threadweaver-4.99.0/threadweaver.yaml 1970-01-01 01:00:00.000000000 +0100 @@ -1 +0,0 @@ -tier: 1 -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
