Showing posts with label signal. Show all posts
Showing posts with label signal. Show all posts

Sunday, July 03, 2011

Cross thread signal delivery fixed!

At work we've been chasing for a long time a problem in which thread T1 emitted signal S1 and then signal S2 connected to an object in thread T2 but they were received in that object in the reverse order, that is, S2 first and S1 later.

First we though it was our fault since the code in those classes is not as clean as it should be, but after days we could not find anything specially wrong in our code so started looking down to Qt.

Just after one day I was able to locate a problem in QObject::moveToThread that did not keep the entries in QPostEventList properly sorted and was able to produce a quick patch to fix our issue. Unfortunately it has taken around one month for that patch to hit upstream (no idea if it stalled in my company, digia or nokia) and the bug being fixed by Olivier (with a patch better than mine).

Bottom line: If you can not find the bug in your code it's maybe because it's not there :D