[Qt-interest] Drag and Drop when source is deleted

Martin Grossberger mgrossberger at andtek.com
Thu May 19 17:54:17 CEST 2011


Hello all,

I have an issue with Drag&Drop, with which I hope you can help me:
I have subclassed (twice) a QWidget and enabled dragging it. The widget 
also gets automatically deleted when an event hits.
Now, if the widget gets deleted while I am dragging it, I can continue 
dragging, however once I drop it somewhere, the program crashes. The 
stacktrace from the debugger is:
0    QDrag::setMimeData    qdrag.cpp    145    0x047eb579
1    QDragManager::drag    qdnd_win.cpp    973    0x0484fa75
2    QDrag::start    qdrag.cpp    314    0x047eb8b6
3    MyCustomWidget::dragEvent    mycustomwidget.cpp    1285    0x0041ca80
4    MyWidget::mouseMoveEvent    mywidget.cpp    573    0x00526286
5    MyCustomWidget::mouseMoveEvent    mycustomwidget.cpp    1486    
0x0041e814
6    QWidget::event    qwidget.cpp    7983    0x0482cee8
7    QApplicationPrivate::notify_helper    qapplication.cpp    4300    
0x047e2520
8    QApplication::notify    qapplication.cpp    3865    0x047e0723
9    QCoreApplication::notifyInternal    qcoreapplication.cpp    704    
0x6a1fd302
10    QCoreApplication::sendSpontaneousEvent    qcoreapplication.h    
218    0x04e36eba
11    QApplicationPrivate::sendMouseEvent    qapplication.cpp    2963    
0x047def40
12    QETWidget::translateMouseEvent    qapplication_win.cpp    3230    
0x04847f10
13    QtWndProc at 16    qapplication_win.cpp    1623    0x0484309d
14    USER32!IsDialogMessageW    C:\Windows\syswow64\user32.dll    0    
0x75fa6238
15    ??        0    0x00141dec
16    ??        0    0x00000200
17    USER32!AllowForegroundActivation    
C:\Windows\syswow64\user32.dll    0    0x75fa68ea
18    qt_is_translatable_mouse_event    qapplication_win.cpp    1395    
0x04842675
19    USER32!GetMessageExtraInfo    C:\Windows\syswow64\user32.dll    
0    0x75fa7d31
20    ??        0    0x00000000
... <Mehr>

Is there something I can do to prevent the crash (other than deleting 
the widget)? Did I miss something?

I'm using Qt Creator 1.3.1 with Qt 4.6.2 on a Windows7 (x64) machine.

Please let me know if you need any further info.

Kind Regards,
Martin Grossberger



More information about the Qt-interest-old mailing list