Crash in internal QMutex :: lock when deleting a QFrame subclass in dropEvent

I am coding in C ++ with OpenSUSE Linux and use Qt Creator as my IDE.

I have a subclass QFramecalled Interactive, which is the parent for another subclass QFramecalled Window. In Window::dropEventI want to delete event->sourcewhich is an object Interactive. Therefore, I have this setting:

void Window::dropEvent(QDropEvent *event) {

  //after identifying MIME type as an Interactive object:

  Interactive *temp = (qobject_cast<Interactive*>(event->source()));
  temp->deleteLater();

}

Then this is usually normal until I try to do something else in my program, and then I get the following:

(gdb) bt
0  0xf5df218f in QMutex::lock() () from /space/cp/x86/qt/lib/libQtCore.so.4
1  0xf5f05b27 in QCoreApplication::postEvent(QObject*, QEvent*, int) () from /space/cp/x86/qt/lib/libQtCore.so.4
2  0xf5f05e5c in QCoreApplication::postEvent(QObject*, QEvent*) () from /space/cp/x86/qt/lib/libQtCore.so.4
3  0xf5f15ce7 in QObject::deleteLater() () from /space/cp/x86/qt/lib/libQtCore.so.4
4  0xf62ccb00 in ?? () from /space/cp/x86/qt/lib/libQtGui.so.4
5  0xf62b31d2 in QApplication::x11ClientMessage(QWidget*, _XEvent*, bool) () from /space/cp/x86/qt/lib/libQtGui.so.4
6  0xf62bfd04 in QApplication::x11ProcessEvent(_XEvent*) () from /space/cp/x86/qt/lib/libQtGui.so.4
7  0xf62e834f in ?? () from /space/cp/x86/qt/lib/libQtGui.so.4
8  0xf5f0480a in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /space/cp/x86/qt/lib/libQtCore.so.4
9  0xf5f04c52 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /space/cp/x86/qt/lib/libQtCore.so.4
10 0xf5f06f69 in QCoreApplication::exec() () from /space/cp/x86/qt/lib/libQtCore.so.4
11 0xf6238887 in QApplication::exec() () from /space/cp/x86/qt/lib/libQtGui.so.4
12 0x0805d028 in main (argc=138177832, argv=0x83cf3b0) at /home/bbayes/DspGUI/main.cpp:10

Deleted Interactivedoes not refer to any of my codes. This error looks completely internal to Qt. I looked around the Internet but could not find a similar example or solution. Does anyone know how to solve this problem?

+3
2

event- > . , event- > source , , .

+1

Qt Doc , qobject_cast:

cast T, T ( ); 0.

, , , :

Interactive *temp = (qobject_cast<Interactive*>(event->source()));
if (temp != NULL)
{
   temp->deleteLater();
}
+1

All Articles