Unexpected deferred delete
-
Hello.
My c++/qml application somehow receives DeferredDelete event and deletes one of my object in the middle of the the work. I never call DeleteLater or anything so I have no idea who posts this event.
I don't know how to localize bug. I only know that my object is created from c++ and has no parent and is owned by QSharedPointer. If I set parent for my object (for example main window), application works fine, no DeferredDelete event received. If only I change parent to 0, DeferredDelete appears.
Best I can find is a stack trace of the moment when Qt calls QCoreApplication::postEvent to post this DeferredDelete event.
In stack trace below 0x1baa7918 is a pointer to my object, not DeclarativeObjectDelegate or anything else.What can it be? May be some memory corruption in my app, or Qt bug? Any idea what can I do to understand what is going on?
windows xp, Qt 4.8.3
Thanks.
@(gdb) backtrace
#0 QCoreApplication::postEvent (receiver=0x1baa7918, event=0x1ac73dc8,
priority=0) at kernel/qcoreapplication.cpp:1311
#1 0x69dd6148 in QCoreApplication::postEvent (receiver=0x1baa7918,
event=0x1ac73dc8) at kernel/qcoreapplication.cpp:1273
#2 0x69de8900 in QObject::deleteLater (this=0x1baa7918)
at kernel/qobject.cpp:2084
#3 0x00bef7a9 in ~ObjectData (this=0x1bb45ca8)
at qml/qdeclarativeobjectscriptclass.cpp:81
#4 0x0ed8dd7f in ~DeclarativeObjectDelegate (this=0x1bb1a820)
at bridge/qscriptdeclarativeobject.cpp:56
#5 0x0ed7dd36 in ~Data (this=0x1bb48a28) at bridge/qscriptobject.cpp:42
#6 0x0ed7dea1 in ~QScriptObject (this=0x1af5f120)
at bridge/qscriptobject.cpp:52
#7 0x0ed006a1 in QTJSC::Heap::allocate (this=0x1ac3de08, s=28)
at ../3rdparty/javascriptcore/JavaScriptCore/runtime/Collector.cpp:388
#8 0x0ede8fb4 in QTJSC::JSCell::operator new (size=28, exec=0x1ad18144)
at ../3rdparty/javascriptcore/JavaScriptCore/runtime/JSCell.h:167
#9 0x0edabfbe in QScriptEnginePrivate::newObject (this=0x1ac3cd00)
at api/qscriptengine_p.h:908
#10 0x0ed6cef0 in QScriptEngine::newObject (this=0x1ac3ca50)
at api/qscriptengine.cpp:2270
#11 0x0ed6d21d in QScriptEngine::newFunction (this=0x1ac3ca50,
fun=0xb473ea <Node::lastChild(QScriptContext*, QScriptEngine*)>, length=0)
at api/qscriptengine.cpp:2363
#12 0x00b47f86 in Node::prototype (engine=0x1ac3ca50)
at qml/qdeclarativexmlhttprequest.cpp:475
#13 0x00b486e4 in Attr::prototype (engine=0x1ac3ca50)
at qml/qdeclarativexmlhttprequest.cpp:531
#14 0x00b48312 in Node::create (engine=0x1ac3ca50, data=0x1bbcd530)
at qml/qdeclarativexmlhttprequest.cpp:489
#15 0x00b4b15d in NamedNodeMapClass::property (this=0x1bb09d68,
object=@0x22c740, id=1) at qml/qdeclarativexmlhttprequest.cpp:886
#16 0x0ed7e9d0 in QScript::ClassObjectDelegate::getOwnPropertySlot (
this=0x1baa7a08, object=0x1af5ec40, exec=0x1ad18144,
propertyName=@0x22c840, slot=@0x22c808)
at bridge/qscriptclassobject.cpp:80
#17 0x0ed7dfd3 in QScriptObject::getOwnPropertySlot (this=0x1af5ec40,
exec=0x1ad18144, propertyName=@0x22c840, slot=@0x22c808)
at bridge/qscriptobject.cpp:61
#18 0x0ede8e85 in QTJSC::JSCell::fastGetOwnPropertySlot (this=0x1af5ec40,
exec=0x1ad18144, propertyName=@0x22c840, slot=@0x22c808)
at ../3rdparty/javascriptcore/JavaScriptCore/runtime/JSObject.h:382
#19 0x0ee5fccd in QTJSC::JSValue::get (this=0x22c84c, exec=0x1ad18144,
propertyName=@0x22c840, slot=@0x22c808)
at ../3rdparty/javascriptcore/JavaScriptCore/runtime/JSObject.h:618
#20 0x0ee5fbda in QTJSC::JSValue::get (this=0x22c84c, exec=0x1ad18144,
propertyName=@0x22c840)
at ../3rdparty/javascriptcore/JavaScriptCore/runtime/JSObject.h:603@ -
Stack trace part 2.
@#21 0x0ecea4fd in cti_op_get_by_val (args=0x22c8ac)
at ../3rdparty/javascriptcore/JavaScriptCore/jit/JITStubs.cpp:1988
#22 0x0ece5f8a in QTJSC::JITThunks::tryCacheGetByID (callFrame=0x1ccc27cc,
codeBlock=0x1ac3ff1c, returnAddress={m_value = 0x1ad18144}, baseValue=
{m_ptr = 0x1ac3de54}, propertyName=@0xf03909c, slot=@0x1ac3d270,
stubInfo=0x22c917)
at ../3rdparty/javascriptcore/JavaScriptCore/jit/JITStubs.cpp:926
#23 0x0edea0b9 in QTJSC::JITCode::execute (this=0x1bac2808,
registerFile=0x1ac3ff1c, callFrame=0x1ad18024, globalData=0x1ac3d270,
exception=0x1ac3de54)
at ../3rdparty/javascriptcore/JavaScriptCore/jit/JITCode.h:79
#24 0x0ecc4c04 in QTJSC::Interpreter::execute (this=0x1ac3ff10,
functionExecutable=0x1bac27f8, callFrame=0x1ac40124, function=0x1af614a0,
thisObj=0x1af42540, args=@0x22ca48, scopeChain=0x1ba4b848,
exception=0x1ac3de54)
at ../3rdparty/javascriptcore/JavaScriptCore/interpreter/Interpreter.cpp:71
#25 0x0ed14b1f in QTJSC::JSFunction::call (this=0x1af614a0, exec=0x1ac40124,
thisValue={m_ptr = 0x1af42540}, args=@0x22ca48)
at ../3rdparty/javascriptcore/JavaScriptCore/runtime/JSFunction.cpp:122
#26 0x0ecffa0e in QTJSC::call (exec=0x1ac40124, functionObject=
{m_ptr = 0x1af614a0}, callType=QTJSC::CallTypeJS, callData=@0x22ca54,
thisValue={m_ptr = 0x1af42540}, args=@0x22ca48)
at ../3rdparty/javascriptcore/JavaScriptCore/runtime/CallData.cpp:62
#27 0x0ed7b1e2 in QScriptValue::call (this=0x22caa8, thisObject=@0x22cabc,
args=@0x22cab8) at api/qscriptvalue.cpp:1604
#28 0x00b4ecf1 in QDeclarativeXMLHttpRequest::dispatchCallback (
this=0x1bb896d8, me=0x1bb89710) at qml/qdeclarativexmlhttprequest.cpp:1396
#29 0x00b4e633 in QDeclarativeXMLHttpRequest::finished (this=0x1bb896d8)
at qml/qdeclarativexmlhttprequest.cpp:1312
#30 0x00b54fe5 in QDeclarativeXMLHttpRequest::qt_static_metacall (
_o=0x1bb896d8, _c=QMetaObject::InvokeMetaMethod, _id=2, _a=0x22cc00)
at tmp/moc/debug_shared/qdeclarativexmlhttprequest.moc:55
#31 0x69deba77 in QMetaObject::activate (sender=0x1bb7e540, m=0x6cc3d280,
local_signal_index=1, argv=0x0) at kernel/qobject.cpp:3547
#32 0x6cbea633 in QNetworkReply::finished (this=0x1bb7e540)
at tmp/moc/debug_shared/moc_qnetworkreply.cpp:166
#33 0x6cb875c3 in QNetworkReplyImplPrivate::finished (this=0x1bb9cd10)
at access/qnetworkreplyimpl.cpp:795
#34 0x6cb70c2c in QNetworkAccessBackend::finished (this=0x1bb96668)
at access/qnetworkaccessbackend.cpp:324
#35 0x6cb79b83 in QNetworkAccessHttpBackend::replyFinished (this=0x1bb96668)
at access/qnetworkaccesshttpbackend.cpp:753
#36 0x6cbe9ab2 in QNetworkAccessHttpBackend::qt_static_metacall (
_o=0x1bb96668, _c=QMetaObject::InvokeMetaMethod, _id=7, _a=0x1bb74e28)
at tmp/moc/debug_shared/moc_qnetworkaccesshttpbackend_p.cpp:96
#37 0x69de53f8 in QMetaCallEvent::placeMetaCall (this=0x1bb9fcf0,
object=0x1bb96668) at kernel/qobject.cpp:525
#38 0x69de7234 in QObject::event (this=0x1bb96668, e=0x1bb9fcf0)
at kernel/qobject.cpp:1195
#39 0x0476bf46 in QApplicationPrivate::notify_helper (this=0x1a9688e0,
receiver=0x1bb96668, e=0x1bb9fcf0) at kernel/qapplication.cpp:4557
#40 0x04769899 in QApplication::notify (this=0x22f630, receiver=0x1bb96668,
e=0x1bb9fcf0) at kernel/qapplication.cpp:3939
#41 0x69dd5a3e in QCoreApplication::notifyInternal (this=0x22f630,
receiver=0x1bb96668, event=0x1bb9fcf0) at kernel/qcoreapplication.cpp:915
#42 0x69e46b00 in QCoreApplication::sendEvent (receiver=0x1bb96668,
event=0x1bb9fcf0)
at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:231
#43 0x69dd6959 in QCoreApplicationPrivate::sendPostedEvents (receiver=0x0,
event_type=0, data=0x1a968a18) at kernel/qcoreapplication.cpp:1539
#44 0x69dfb21b in qt_internal_proc (hwnd=0x300218, message=1025, wp=0, lp=0)
at kernel/qeventdispatcher_win.cpp:496
#45 0x77d38709 in USER32!GetDC () from C:\WINDOWS\system32\user32.dll
#46 0x00300218 in ?? ()
#47 0x00000401 in ?? ()
#48 0x00000000 in ?? ()@