Strange Bug: Signal <-> Slot connection not working in Qt 4.4 - works in Qt 4.5

Hamish Rodda rodda at kde.org
Wed Apr 22 14:19:05 UTC 2009


On Wednesday 22 April 2009 22:32:07 Milian Wolff wrote:
> Hello fellow developers!
>
> I'm working on KDevelop and I stumbled upon a strange bug which I cannot
> solve. Basically we do a connect() which returns true but at the point we
> have the emit of the signal receivers() returns 0 (and the slot never gets
> called of course).
>
> This problem only seems to occur in Qt 4.4 / Kde 4.2 and not in Qt 4.5... I
> already showed this problem to zwabel, adymo, apol, apaku and other
> KDevelop people but they are clueless as well. Apaku could reproduce the
> problem on his Qt 4.4 machine at work.
>
> So, does anyone of you can help me? Or do you guys at least can give me a
> hint on where to look? I don't actually want to start to debug QObject (not
> even sure I'd be up to it). Here's a description on how to (possibly)
> reproduce the problem:
>
> compile a recent version of KDevplatform and KDevelop, start KDevelop
> attach to that instance with gdb and set the following breakpoint:
>
> break 'KDevelop::DUChain::documentLoadedPrepare(KDevelop::IDocument*)'
>
> Open up any .cpp / .h file and see if it hits the breakpoint. For me (and
> apaku on his Qt 4.4 machine) this slot is never getting called... In Qt 4.5
> it magically works.
>
> I checked the code and could not find a cause why the signal<->slot
> connection should would be released... Neither the duchain nor the document
> get removed...
>
> A bit more in-depth information:
> KDevelop::DUChain::DUChain
> -> connects it's documentLoadedPrepare slot to the
>    documentLoadedPrepare signal from KDevelop::IDocument
>
> KDevelop::IDocument::notifyLoaded
> -> emits the documentLoadedPrepare signal
>
> NOTE: notifyLoaded is getting called! it's just that the emit in there has
> no receivers...
>
> KDevelop::TextDocument::slotDocumentLoaded
> -> calls notifyLoaded on the IDocument
>
> KDevelop::TextDocument::slotDocumentLoaded is connected in the TextDocument
> ctor to the textchanged and documentloaded signals of
> KTextEditor::Document.
>
> It would be great if somebody could give us a hint!

Maybe add some code just before the emit to query the number of connected 
slots for the signal, and print that... see if it's different qt 4.4 vs 4.5...

Cheers,
Hamish.




More information about the KDevelop-devel mailing list