Details
-
Bug
-
Resolution: Done
-
Not Evaluated
-
None
-
4.8.3
-
None
-
Windows 7 x64
vs2010
-
Change-Id: I764fea4a0826cff751dd74a0fb67e0d2971c1d49
Description
Run the attached sample program and push the push button, an assertion will occur because of a invalid QWExtra * pointer in QWidgetPrivate::unregisterOleDnd()
This bug was introduced in commit f6bf4b2baa91e55f40596bf3f2823b119fdfa5e0 since the removal of the following lines in src/gui/kernel/qwidget_win.cpp:
if (!nativeParent->acceptDrops())
nativeParent->setAcceptDrops(true);
When you push the button, the sample program will call set setAcceptDrops(true) to a tool button and then call winId() to its parent widget (NOTE: this widget is not the top level widget). then I delete the tool button widget, QWidgetPrivate::unregisterOleDnd() will be called, it will find the tool button's native parent widget which is now the widget which I have call winId() ealier, but since the removal lines in commit f6bf4b2baa91e55f40596bf3f2823b119fdfa5e0 , it is not guaranteed the QWExtra object will be created for its parent widget, thus a crash will occur.
I think we should check QWExtra * pointer in QWidgetPrivate::unregisterOleDnd(), if that is null we should do nothing and return.