QThread 4.8.3 and 4.8.4 Bug

Questions about applications and software
Forum rules
Before you post please read this

QThread 4.8.3 and 4.8.4 Bug

Postby Jim Jensen on Thu Mar 14, 2013 9:52 pm

In QThread 4.6.2 and 4.7.4, the running and finished attributes are correctly set to false and true, respectively, just before the finished() signal is emitted. Thus, for example, a SLOT handling the finished() signal on behalf of several threads could detect which thread finished() by examining the finished attribute. Unfortunately, in QThread 4.8.3 (supplied with Mint 14.1) and QThread 4.8.4 the running and finished attributes are set sometime AFTER the finished() signal is emitted--and my app is broken.

The error is in qthread_unix.cpp (and in qthread_win.cpp): In QThread 4.7.4, qthread_unix.cpp at line 356 the correct sequence occurs [note that the running and finished attributes are set before emitting the finished() signal]:
d->running = false;
d->finished = true;
if (d->terminated)
emit thr->terminated();
d->terminated = false;
emit thr->finished();

In QThread 4.8.3 and 4.8.4, qthread_unix.cpp incorrectly reads near line 359:
emit thr->finished();
QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
QThreadStorageData::finish((void **)data);
locker.relock();
d->terminated = false;

QAbstractEventDispatcher *eventDispatcher = d->data->eventDispatcher;
if (eventDispatcher) {
d->data->eventDispatcher = 0;
locker.unlock();
eventDispatcher->closingDown();
delete eventDispatcher;
locker.relock();
}

d->thread_id = 0;
d->running = false;
d->finished = true;

The code should be corrected so that the d->running = false; and d->finished = true; are placed in front of the emit thr->finished(); as is correctly the case in 4.6.2 and 4.7.4
Jim Jensen
Level 1
Level 1
 
Posts: 7
Joined: Thu Mar 14, 2013 9:34 pm

Linux Mint is funded by ads and donations.
 

Return to Software & Applications

Who is online

Users browsing this forum: Yahoo [Bot] and 29 guests