Vidalia 0.2.x triggering Qt assertion on exit
When using a recent Qt like 4.7.2 compiled with assertions enabled, Vidalia triggers a Qt assertion on exit and dumps core.
fk@r500 ~ $/usr/obj/usr/ports/net-mgmt/vidalia/work/vidalia-0.2.12/src/vidalia/vidalia --loglevel notice May 13 15:13:19.131 [notice] Resetting UI translation to English default. May 13 15:13:19.213 [notice] Vidalia 0.2.12 using Qt 4.7.2 May 13 15:13:19.283 [notice] QtWarningMsg: Application asked to unregister timer 0x9000004 which is not registered in this thread. Fix application. May 13 15:13:19.549 [notice] Tor status changed from 'Unset' to 'Stopped'. May 13 15:13:21.597 [notice] Tor status changed from 'Stopped' to 'Starting'. May 13 15:13:21.640 [notice] Tor status changed from 'Starting' to 'Started'. May 13 15:13:21.655 [notice] Tor status changed from 'Started' to 'Authenticating'. May 13 15:13:21.663 [notice] Authenticating using 'null' authentication. May 13 15:13:32.814 [notice] Tor status changed from 'Authenticating' to 'Authenticated'. May 13 15:13:32.815 [notice] Tor status changed from 'Authenticated' to 'Circuit Established'. May 13 15:13:47.074 [notice] Cleaning up before exiting. May 13 15:13:47.080 [notice] Vidalia is exiting cleanly (return code 0). May 13 15:13:47.250 [notice] QtWarningMsg: QSocketNotifier: socket notifiers cannot be disabled from another thread May 13 15:13:47.251 [notice] QtWarningMsg: QSocketNotifier: Invalid socket 12 and type 'Read', disabling... [... more complaints about socket 12 being invalid ...] May 13 15:13:47.276 [notice] QtWarningMsg: QSocketNotifier: Invalid socket 12 and type 'Read', disabling... May 13 15:13:47.291 [error] QtFatalMsg: ASSERT failure in QCoreApplication::sendEvent: "Cannot send events to objects owned by a different thread. Current thread 80581b0f0. Receiver '' (of type 'QNativeSocketEngine') was created in thread 80582fd80", file kernel/qcoreapplication.cpp, line 349 May 13 15:13:47.294 [notice] QtWarningMsg: QSocketNotifier: Invalid socket 12 and type 'Read', disabling... [... more complaints about socket 12 being invalid ...] May 13 15:13:47.338 [notice] QtWarningMsg: QSocketNotifier: Invalid socket 12 and type 'Read', disabling... ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZMay 13 15:13:47.338 [notice] QtWarningMsg: QSocketNotifier: Invalid socket 12 and type 'Read', disabling... May 13 15:13:47.338 [error] Fatal Qt error. Aborting. May 13 15:13:47.339 [notice] QtWarningMsg: QSocketNotifier: Invalid socket 12 and type 'Read', disabling... Abort trap: 6 (core dumped)
fk@r500 ~ $gdb /usr/obj/usr/ports/net-mgmt/vidalia/work/vidalia-0.2.12/src/vidalia/vidalia vidalia.core GNU gdb 6.1.1 [FreeBSD] Copyright 2004 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are [...] Loaded symbols for /libexec/ld-elf.so.1 #0 0x000000080345ddbc in thr_kill () from /lib/libc.so.7 [New Thread 80580a800 (LWP 102150/vidalia)] [New Thread 805807400 (LWP 100612/initial thread)] (gdb) where #0 0x000000080345ddbc in thr_kill () from /lib/libc.so.7 #1 0x00000008034fcbe3 in abort () from /lib/libc.so.7 #2 (closed) 0x00000000004e4aa6 in Vidalia::qt_msg_handler (type=QtFatalMsg, s=0x8058327d8 "ASSERT failure in QCoreApplication::sendEvent: "Cannot send events to objects owned by a different thread. Current thread 80581b0f0. Receiver '' (of type 'QNativeSocketEngine') was created in thread 8"...) at /usr/obj/usr/ports/net-mgmt/vidalia/work/vidalia-0.2.12/src/vidalia/Vidalia.cpp:86 #3 (closed) 0x00000008025c0ceb in qt_message_output (msgType=QtFatalMsg, buf=0x8058327d8 "ASSERT failure in QCoreApplication::sendEvent: "Cannot send events to objects owned by a different thread. Current thread 80581b0f0. Receiver '' (of type 'QNativeSocketEngine') was created in thread 8"...) at global/qglobal.cpp:2228 #4 (closed) 0x00000008025c0f6b in qt_message (msgType=QtFatalMsg, msg=0x80278cdf8 "ASSERT failure in %s: "%s", file %s, line %d", ap=0x7fffffffba30) at global/qglobal.cpp:2328 #5 (closed) 0x00000008025c1084 in qFatal (msg=0x80278cdf8 "ASSERT failure in %s: "%s", file %s, line %d") at global/qglobal.cpp:2511 #6 (closed) 0x00000008025c10ca in qt_assert_x (where=0x8027eb31c "QCoreApplication::sendEvent", what=0x80587c058 "Cannot send events to objects owned by a different thread. Current thread 80581b0f0. Receiver '' (of type 'QNativeSocketEngine') was created in thread 80582fd00", file=0x8027eabe8 "kernel/qcoreapplication.cpp", line=349) at global/qglobal.cpp:2035 #7 (closed) 0x00000008026fd0fa in QCoreApplicationPrivate::checkReceiverThread (this=0x80587d1c0, receiver=0x807860070) at kernel/qcoreapplication.cpp:341 #8 (closed) 0x00000008010c6b26 in QApplication::notify (this=0x7fffffffd390, receiver=0x807860070, e=0x7fffffffc4e0) at kernel/qapplication.cpp:3754 #9 (closed) 0x00000008026fc1e0 in QCoreApplication::notifyInternal (this=0x7fffffffd390, receiver=0x807860070, event=0x7fffffffc4e0) at kernel/qcoreapplication.cpp:731 #10 (closed) 0x00000008010c34bb in QCoreApplication::sendEvent (receiver=0x807860070, event=0x7fffffffc4e0) at qcoreapplication.h:215 #11 (closed) 0x00000008027154f8 in QObjectPrivate::setParent_helper (this=0x807861780, o=0x0) at kernel/qobject.cpp:1981 #12 (closed) 0x000000080271b8a5 in ~QObject (this=0x8078a6280) at kernel/qobject.cpp:954 #13 (closed) 0x000000080272460e in ~QSocketNotifier (this=0x8078a6280) at kernel/qsocketnotifier.cpp:229 #14 (closed) 0x000000080221e257 in ~QReadNotifier (this=0x8078a6280) at socket/qnativesocketengine.cpp:1088 #15 (closed) 0x0000000802711b77 in qDeleteInEventHandler (o=0x8078a6280) at kernel/qobject.cpp:3986 #16 (closed) 0x000000080221bc94 in QNativeSocketEngine::close (this=0x807860070) at socket/qnativesocketengine.cpp:821 #17 (closed) 0x000000080222fd14 in QAbstractSocketPrivate::resetSocketLayer (this=0x807888800) at socket/qabstractsocket.cpp:508 #18 (closed) 0x00000008022300e2 in QAbstractSocket::disconnectFromHostImplementation (this=0x807860050) at socket/qabstractsocket.cpp:2464 #19 (closed) 0x000000080223285a in QAbstractSocket::qt_metacall (this=0x807860050, _c=QMetaObject::InvokeMetaMethod, _id=10, _a=0x7fffffffc880) at moc_qabstractsocket.cpp:114 #20 (closed) 0x0000000802264279 in QTcpSocket::qt_metacall (this=0x807860050, _c=QMetaObject::InvokeMetaMethod, _id=18, _a=0x7fffffffc880) at .moc/debug-shared/moc_qtcpsocket.cpp:64 #21 (closed) 0x00000008027048d2 in QMetaObject::metacall (object=0x807860050, cl=QMetaObject::InvokeMetaMethod, idx=18, argv=0x7fffffffc880) at kernel/qmetaobject.cpp:237 #22 (closed) 0x00000008027081f6 in QMetaMethod::invoke (this=0x7fffffffcd90, object=0x807860050, connectionType=Qt::DirectConnection, returnValue={ = {_data = 0x0, _name = 0x0}, }, val0={_data = 0x0, _name = 0x0}, val1={_data = 0x0, _name = 0x0}, val2={_data = 0x0, _name = 0x0}, val3={_data = 0x0, _name = 0x0}, val4={_data = 0x0, _name = 0x0}, val5={_data = 0x0, _name = 0x0}, val6= {_data = 0x0, _name = 0x0}, val7={_data = 0x0, _name = 0x0}, val8={_data = 0x0, _name = 0x0}, val9={_data = 0x0, _name = 0x0}) at kernel/qmetaobject.cpp:1578 #23 (closed) 0x00000008027091c3 in QMetaObject::invokeMethod (obj=0x807860050, member=0x80227cad8 "disconnectFromHostImplementation", type=Qt::DirectConnection, ret= { = {_data = 0x0, _name = 0x0}, }, val0={_data = 0x0, _name = 0x0}, val1={_data = 0x0, _name = 0x0}, val2={_data = 0x0, _name = 0x0}, val3= {_data = 0x0, _name = 0x0}, val4={_data = 0x0, _name = 0x0}, val5={_data = 0x0, _name = 0x0}, val6={_data = 0x0, _name = 0x0}, val7={_data = 0x0, _name = 0x0}, val8={_data = 0x0, _name = 0x0}, val9= {_data = 0x0, _name = 0x0}) at kernel/qmetaobject.cpp:1151 #24 (closed) 0x000000080219a722 in QMetaObject::invokeMethod (obj=0x807860050, member=0x80227cad8 "disconnectFromHostImplementation", type=Qt::DirectConnection, val0={_data = 0x0, _name = 0x0}, val1= {_data = 0x0, _name = 0x0}, val2={_data = 0x0, _name = 0x0}, val3={_data = 0x0, _name = 0x0}, val4={_data = 0x0, _name = 0x0}, val5={_data = 0x0, _name = 0x0}, val6={_data = 0x0, _name = 0x0}, val7= {_data = 0x0, _name = 0x0}, val8={_data = 0x0, _name = 0x0}, val9={_data = 0x0, _name = 0x0}) at qobjectdefs.h:408 #25 (closed) 0x000000080222ddfc in QAbstractSocket::disconnectFromHost (this=0x807860050) at socket/qabstractsocket.cpp:2373 #26 (closed) 0x00000000005230fc in ControlSocket::disconnectFromHost (this=0x8078a6040) at /usr/obj/usr/ports/net-mgmt/vidalia/work/vidalia-0.2.12/src/torcontrol/ControlSocket.cpp:78 #27 (closed) 0x00000000005205b1 in ControlConnection::disconnect (this=0x80582fd00) at /usr/obj/usr/ports/net-mgmt/vidalia/work/vidalia-0.2.12/src/torcontrol/ControlConnection.cpp:127 #28 (closed) 0x00000000005120e6 in TorControl::disconnect (this=0x8058b0980) at /usr/obj/usr/ports/net-mgmt/vidalia/work/vidalia-0.2.12/src/torcontrol/TorControl.cpp:209 #29 (closed) 0x00000000005123cf in ~TorControl (this=0x8058b0980) at /usr/obj/usr/ports/net-mgmt/vidalia/work/vidalia-0.2.12/src/torcontrol/TorControl.cpp:102 #30 (closed) 0x00000000004e37ef in Vidalia (this=0x7fffffffd390) at /usr/obj/usr/ports/net-mgmt/vidalia/work/vidalia-0.2.12/src/vidalia/Vidalia.cpp:151
I can reliably reproduce this by letting Vidalia connect to a Control Port first, but it doesn't happen if Vidalia exits without connection to Tor first. Due to #3168 (closed) I couldn't check if this is still an issue in 0.3.0.
This also happened with Vidalia 0.2.10 and I don't think it's a recent Vidalia regression but a result of recent Qt versions being more strict about punishing what the Qt developers consider API violations.
I'm using FreeBSD 9.0-CURRENT amd64 but don't think the problem is platform-specific.
There was a similar issue in VLC a while ago: http://mailman.videolan.org/pipermail/vlc-devel/2010-November/077810.html with the fix being: http://www.mail-archive.com/vlc-commits@videolan.org/msg01974.html