Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-27263

Crash caused by dnd and winId()

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Not Evaluated
    • None
    • 4.8.3
    • GUI: Drag and Drop
    • 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.

      Attachments

        1. testWinId.rar
          5 kB
          liang jian
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            Unassigned Unassigned
            jianliang79 liang jian
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes