[Warning] QObject::disconnect: Unexpected null parameter in QNetworkAccessManager
-
Hello everyone,
I'm trying to find the source of this warning in the program I'm working on:
[Warning] QObject::disconnect: Unexpected null parameter
It happens sometimes as I switch Wifi on/off. In order to trace it I've modified Qobject to break into debugger when it happens, but it seems to be coming from the Qt itself. I'm not really sure what's going on here, and would be grateful if someone wiser could take a look and point me to right direction. Is this a bug in Qt, or just some invalid usage of the class?
Qt version is 5.7.1, and it happens on OS X El Capitan 10.11.4.
Here is the trace:
[14:15:29.368] [140735132925952] [Warning] QObject::disconnect: Unexpected null parameter Process 83482 stopped * thread #1: tid = 0x1e533, 0x0000000101d94f1c QtCore`QObject::disconnect(sender=<unavailable>, signal="2stateChanged(QNetworkSession::State)", receiver=0x00000001036df1e0, method="1_q_networkSessionStateChanged(QNetworkSession::State)") + 3308 at qobject.cpp:2910, queue = 'com.apple.main-thread', stop reason = EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0) frame #0: 0x0000000101d94f1c QtCore`QObject::disconnect(sender=<unavailable>, signal="2stateChanged(QNetworkSession::State)", receiver=0x00000001036df1e0, method="1_q_networkSessionStateChanged(QNetworkSession::State)") + 3308 at qobject.cpp:2910 2907 { 2908 if (sender == 0 || (receiver == 0 && method != 0)) { 2909 qWarning("QObject::disconnect: Unexpected null parameter"); -> 2910 __builtin_trap(); 2911 return false; 2912 } 2913 (lldb) bt * thread #1: tid = 0x1e533, 0x0000000101d94f1c QtCore`QObject::disconnect(sender=<unavailable>, signal="2stateChanged(QNetworkSession::State)", receiver=0x00000001036df1e0, method="1_q_networkSessionStateChanged(QNetworkSession::State)") + 3308 at qobject.cpp:2910, queue = 'com.apple.main-thread', stop reason = EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0) * frame #0: 0x0000000101d94f1c QtCore`QObject::disconnect(sender=<unavailable>, signal="2stateChanged(QNetworkSession::State)", receiver=0x00000001036df1e0, method="1_q_networkSessionStateChanged(QNetworkSession::State)") + 3308 at qobject.cpp:2910 frame #1: 0x00000001028c2f14 QtNetwork`QNetworkAccessManagerPrivate::_q_networkSessionClosed(this=0x00000001036df5a0) + 196 at qnetworkaccessmanager.cpp:1608 frame #2: 0x0000000101d8f9f2 QtCore`QObject::event(this=<unavailable>, e=<unavailable>) + 146 at qobject.cpp:1263 frame #3: 0x0000000102c2552a QtWidgets`QApplicationPrivate::notify_helper(this=<unavailable>, receiver=0x00000001036df1e0, e=0x0000000115f104a0) + 314 at qapplication.cpp:3799 frame #4: 0x0000000102c2695e QtWidgets`QApplication::notify(this=<unavailable>, receiver=<unavailable>, e=<unavailable>) + 510 at qapplication.cpp:3159 frame #5: 0x0000000101d64164 QtCore`QCoreApplication::notifyInternal2(receiver=0x00000001036df1e0, event=0x0000000115f104a0) + 164 at qcoreapplication.cpp:988 frame #6: 0x0000000101d64ecb QtCore`QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) [inlined] QCoreApplication::sendEvent(receiver=0x00000001036df1e0, event=<unavailable>) + 891 at qcoreapplication.h:231 frame #7: 0x0000000101d64eb3 QtCore`QCoreApplicationPrivate::sendPostedEvents(receiver=0x0000000000000000, event_type=0, data=0x00000001046ed040) + 867 at qcoreapplication.cpp:1649 frame #8: 0x000000010893919e libqcocoa.dylib`QCocoaEventDispatcherPrivate::processPostedEvents(this=0x0000000108f008c0) + 190 at qcocoaeventdispatcher.mm:889 frame #9: 0x0000000108939a51 libqcocoa.dylib`QCocoaEventDispatcherPrivate::postedEventsSourceCallback(info=0x0000000108f008c0) + 33 at qcocoaeventdispatcher.mm:926 frame #10: 0x00007fff98c0f881 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17 frame #11: 0x00007fff98beefbc CoreFoundation`__CFRunLoopDoSources0 + 556 frame #12: 0x00007fff98bee4df CoreFoundation`__CFRunLoopRun + 927 frame #13: 0x00007fff98beded8 CoreFoundation`CFRunLoopRunSpecific + 296 frame #14: 0x00007fff933a8935 HIToolbox`RunCurrentEventLoopInMode + 235 frame #15: 0x00007fff933a876f HIToolbox`ReceiveNextEventCommon + 432 frame #16: 0x00007fff933a85af HIToolbox`_BlockUntilNextEventMatchingListInModeWithFilter + 71 frame #17: 0x00007fff8df3cefa AppKit`_DPSNextEvent + 1067 frame #18: 0x00007fff8df3c32a AppKit`-[NSApplication _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 454 frame #19: 0x00007fff8df30e84 AppKit`-[NSApplication run] + 682 frame #20: 0x000000010893896f libqcocoa.dylib`QCocoaEventDispatcher::processEvents(this=0x00000001046fbea0, flags=<unavailable>) + 2191 at qcocoaeventdispatcher.mm:422 frame #21: 0x0000000101d60341 QtCore`QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) [inlined] QEventLoop::processEvents(flags=<unavailable>) + 417 at qeventloop.cpp:134 frame #22: 0x0000000101d60311 QtCore`QEventLoop::exec(this=0x00007fff5fbff700, flags=<unavailable>) + 369 at qeventloop.cpp:212 frame #23: 0x0000000101d647d5 QtCore`QCoreApplication::exec() + 341 at qcoreapplication.cpp:1261 frame #24: 0x0000000100008a05 TopTracker`main(argc=1, argv=0x00007fff5fbffa88) + 1893 at main.cpp:288 frame #25: 0x00007fff8f4a15ad libdyld.dylib`start + 1 frame #26: 0x00007fff8f4a15ad libdyld.dylib`start + 1
Thank you.
-
HI and welcome to devnet,
Looks like a "bad timing" situation. The disconnect likely happens after the originally connected object has been deleted. One place to start looking at is the corewlan bearer plugin.
-
Thanks for the pointer. It seems
QNetworkManager
's shared pointer toQNetworkSession
gets deleted somewhere along the way. Looks more like an internal Qt issue to me. -
I confirm I have the very same stack here. The same code was working fine with Qt 5.6, I highly suspect a regression in Qt.
-
@CanardMoussant
Hi
Is it possible to reproduce this in a small sample?
That is needed to open a bug report and increases the changes
of a fix. -
I will try to work on that. Unfortunately for the moment I see this in a program with a significant amount of code, and I would need to narrow it down to a small reproducer.
-
I can reproduce this issue. I have created relative bug QTBUG-57110