Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Qt 5.0.2 & 5.1.0 Drag and Drop crash
Forum Updated to NodeBB v4.3 + New Features

Qt 5.0.2 & 5.1.0 Drag and Drop crash

Scheduled Pinned Locked Moved General and Desktop
25 Posts 7 Posters 13.5k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    SoulSharer
    wrote on last edited by
    #9

    [quote author="SGaist" date="1365890494"]Hi,

    Hope you don't mind me asking that, but would aren't you reinventing the wheel ? Drag and Drop support are already supported in QTableWidget and QListWidget.

    You might better go overloading "QTableWidget::dropMimeData":http://qt-project.org/doc/qt-4.8/qtablewidget.html#dropMimeData and "QListWidget::mimeData":http://qt-project.org/doc/qt-4.8/qlistwidget.html#mimeData

    You would then only have to care about your data.

    Hope it helps[/quote]

    Didn't know about that, thanks. I might use it for most of the stuff, but I still want to find out what's wrong with current code if possible.

    1 Reply Last reply
    0
    • raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by
      #10

      This code looks good so far ... the problem must be somewhere else.

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      1 Reply Last reply
      0
      • B Offline
        B Offline
        bodzio131
        wrote on last edited by
        #11

        Do you manage QObject descendants by yourself? Maybe you delete such objects directly (instead of deleteLater) or you use smart pointers with such objects. It could be a real problem if you interfere with Qt objects management model.

        I think you need to narrow your project by cutting whatever you can step by step, or try to use the same drag-drop logic in simpler app. However, I suppose the problem can be far away from part which shows crash :(

        1 Reply Last reply
        0
        • S Offline
          S Offline
          SoulSharer
          wrote on last edited by
          #12

          Thanks for the help.

          [quote author="Bogdan" date="1365933102"]Do you manage QObject descendants by yourself? Maybe you delete such objects directly (instead of deleteLater) or you use smart pointers with such objects. It could be a real problem if you interfere with Qt objects management model.

          I think you need to narrow your project by cutting whatever you can step by step, or try to use the same drag-drop logic in simpler app. However, I suppose the problem can be far away from part which shows crash :([/quote]

          No I don't manage anything related to QObject myself and don't use smart pointers at all. The maximum I do is subclassing existing widgets to reimplement drag and drop actions.

          And yeah I will try to cut it into something testable.

          1 Reply Last reply
          0
          • S Offline
            S Offline
            SoulSharer
            wrote on last edited by
            #13

            For some reason in notifyInternal() receiver is NULL (0) after dropping, which causes all of this. Still trying to recreate this issue.

            1 Reply Last reply
            0
            • raven-worxR Offline
              raven-worxR Offline
              raven-worx
              Moderators
              wrote on last edited by
              #14

              this means that you probably deleting objects before the drag has finished.
              Or creating them on the wrong storage location (e.g. stack).

              --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
              If you have a question please use the forum so others can benefit from the solution in the future

              1 Reply Last reply
              0
              • S Offline
                S Offline
                SoulSharer
                wrote on last edited by
                #15

                Thing is I don't allocate on stack or delete them at all, my windows are allocated on heap and are not deleted until main window closes.
                -Checked it once more, everything alright

                Could it be because of some broken relationship between QMainWindows or QWidgets?

                And Dropping does work if I don't do it fast, if I do it fast it gets reciever that is null and so it crashes.

                1 Reply Last reply
                0
                • raven-worxR Offline
                  raven-worxR Offline
                  raven-worx
                  Moderators
                  wrote on last edited by
                  #16

                  Hard to tell if you can't show more code...

                  --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
                  If you have a question please use the forum so others can benefit from the solution in the future

                  1 Reply Last reply
                  0
                  • S Offline
                    S Offline
                    SoulSharer
                    wrote on last edited by
                    #17

                    Never mind, thanks for help anyway.

                    1 Reply Last reply
                    0
                    • W Offline
                      W Offline
                      wizzhard
                      wrote on last edited by
                      #18

                      Hello,

                      I also experience a crash during drag n drop with the very same callstack after the crash.

                      In my case the crash occurs in a qtreeview when i drag n drop item internally.

                      In fact everything works fine until I double click an item of the view to rename it.

                      1 - I fill the item delegate with the new name
                      2 - Press enter to validate
                      3 - setData of the model is called (but does nothing).
                      4 - I try to drag & drop an item
                      5 - dragEnterEvent is called once.
                      6 - dragMoveEvent is called once
                      7 - program crash in QScopedPointer line134

                      @0 QScopedPointer<QObjectData,QScopedPointerDeleter<QObjectData> >::data qscopedpointer.h 134 0x651f1d4a
                      1 qGetPtrHelper<QScopedPointer<QObjectData,QScopedPointerDeleter<QObjectData> > > qglobal.h 991 0x651df58b
                      2 QObject::d_func qobject.h 119 0x651f0323
                      3 QCoreApplication::notifyInternal qcoreapplication.cpp 764 0x65468230
                      4 QCoreApplication::sendSpontaneousEvent qcoreapplication.h 206 0x65577098
                      5 QWidgetWindow::handleDropEvent qwidgetwindow.cpp 566 0x65d3e759
                      6 QWidgetWindow::event qwidgetwindow.cpp 195 0x65d3d30c
                      7 QApplicationPrivate::notify_helper qapplication.cpp 3398 0x65cc291e
                      8 QApplication::notify qapplication.cpp 2829 0x65cc035a
                      9 QCoreApplication::notifyInternal qcoreapplication.cpp 767 0x65468264
                      10 QCoreApplication::sendEvent qcoreapplication.h 203 0x6546d5e9
                      11 QGuiApplicationPrivate::processDrop qguiapplication.cpp 2228 0x66673045
                      12 QWindowSystemInterface::handleDrop qwindowsysteminterface.cpp 556 0x6665860c
                      13 QWindowsOleDropTarget::Drop qwindowsdrag.cpp 683 0x64eef4dd
                      14 CPrivDragDrop::PrivDragDrop getif.cxx 960 0x770f2b79
                      15 PrivDragDrop getif.cxx 1099 0x770f2d78
                      16 CDropTarget::Drop drag.cpp 2492 0x770ca04d
                      17 CDragOperation::CompleteDrop drag.cpp 1601 0x770c9ede
                      18 DoDragDrop drag.cpp 1964 0x770ca8dd
                      19 QWindowsDrag::drag qwindowsdrag.cpp 802 0x64eef9fa
                      20 QDragManager::drag qdnd.cpp 143 0x666831c8
                      21 QDrag::exec qdrag.cpp 282 0x66681daa
                      22 QAbstractItemView::startDrag qabstractitemview.cpp 3581 0x65faf1a5
                      23 QAbstractItemView::mouseMoveEvent qabstractitemview.cpp 1761 0x65fa9d9b
                      24 QTreeView::mouseMoveEvent qtreeview.cpp 1924 0x65ff6a8b
                      25 QWidget::event qwidget.cpp 7842 0x65d0a0ed
                      26 QFrame::event qframe.cpp 534 0x65e67772
                      27 QAbstractScrollArea::viewportEvent qabstractscrollarea.cpp 1163 0x65f089c4
                      28 QAbstractItemView::viewportEvent qabstractitemview.cpp 1680 0x65fa971b
                      29 QTreeView::viewportEvent qtreeview.cpp 1260 0x65ff3ece
                      30 QAbstractScrollAreaPrivate::viewportEvent qabstractscrollarea_p.h 105 0x65caaf28
                      31 QAbstractScrollAreaFilter::eventFilter qabstractscrollarea_p.h 121 0x65f0a919
                      32 QCoreApplicationPrivate::sendThroughObjectEventFilters qcoreapplication.cpp 863 0x654684f3
                      33 QApplicationPrivate::notify_helper qapplication.cpp 3394 0x65cc2902
                      34 QApplication::notify qapplication.cpp 2962 0x65cc098c
                      35 QCoreApplication::notifyInternal qcoreapplication.cpp 767 0x65468264
                      36 QCoreApplication::sendSpontaneousEvent qcoreapplication.h 206 0x65577098
                      37 QApplicationPrivate::sendMouseEvent qapplication.cpp 2469 0x65cbfab5
                      38 QWidgetWindow::handleMouseEvent qwidgetwindow.cpp 403 0x65d3dd00
                      39 QWidgetWindow::event qwidgetwindow.cpp 155 0x65d3d274
                      40 QApplicationPrivate::notify_helper qapplication.cpp 3398 0x65cc291e
                      41 QApplication::notify qapplication.cpp 2829 0x65cc035a
                      42 QCoreApplication::notifyInternal qcoreapplication.cpp 767 0x65468264
                      43 QCoreApplication::sendSpontaneousEvent qcoreapplication.h 206 0x65577098
                      44 QGuiApplicationPrivate::processMouseEvent qguiapplication.cpp 1417 0x6666ffe4
                      45 QGuiApplicationPrivate::processWindowSystemEvent qguiapplication.cpp 1249 0x6666f852
                      46 QWindowSystemInterface::sendWindowSystemEventsImplementation qwindowsysteminterface.cpp 536 0x66658561
                      47 QWindowSystemInterface::sendWindowSystemEvents qwindowsysteminterface.cpp 516 0x666584e9
                      48 QWindowsGuiEventDispatcher::sendPostedEvents qwindowsguieventdispatcher.cpp 86 0x64ecc014
                      49 qt_internal_proc qeventdispatcher_win.cpp 423 0x654f08d7
                      50 InternalCallWinProc USER32 0x766662fa
                      51 UserCallWinProcCheckWow USER32 0x76666d3a
                      52 DispatchMessageWorker USER32 0x766677c4
                      53 DispatchMessageW USER32 0x7666788a
                      54 QEventDispatcherWin32::processEvents qeventdispatcher_win.cpp 744 0x654f19c3
                      55 QWindowsGuiEventDispatcher::processEvents qwindowsguieventdispatcher.cpp 78 0x64ecbf7e
                      56 QEventLoop::processEvents qeventloop.cpp 137 0x65464ea1
                      57 QEventLoop::exec qeventloop.cpp 212 0x65464ffe
                      58 QCoreApplication::exec qcoreapplication.cpp 1020 0x6546879d
                      59 QGuiApplication::exec qguiapplication.cpp 1184 0x6666f5e8
                      60 QApplication::exec qapplication.cpp 2674 0x65cc0009
                      61 main main.cpp 20 0xbaf6fe
                      62 WinMain qtmain_win.cpp 131 0xc5f5ea
                      63 __tmainCRTStartup crtexe.c 547 0xc5d440
                      64 WinMainCRTStartup crtexe.c 371 0xc5d1cf
                      65 BaseThreadInitThunk kernel32 0x775f33aa
                      66 __RtlUserThreadStart ntdll32 0x77bd9f72
                      67 _RtlUserThreadStart ntdll32 0x77bd9f45 @

                      1 Reply Last reply
                      0
                      • W Offline
                        W Offline
                        wizzhard
                        wrote on last edited by
                        #19

                        I just found something that seems to fix the issue here.

                        http://stackoverflow.com/questions/17373591/qt5-custom-lineedit-widget-qlineedit-subclass-private-variable-crashes-applica

                        I have unchecked acceptDrop on the qtreeview that own the items and it doesn't crash anymore.

                        EDIT : it doesn't works finally, it was the interruption of the debugger that prevented the problem to occur by interrupting the item delegate validation.

                        1 Reply Last reply
                        0
                        • S Offline
                          S Offline
                          SoulSharer
                          wrote on last edited by
                          #20

                          Well, I've updated to 5.1.0, it still crashes. But now it also outputs this:

                          bq. QAccessibleTree::indexFromLogical: invalid index: 1 0 for QTreeWidget(0x4b06408)
                          Cannot creat accessible child interface for object: QTreeWidget(0x4b06408) index: 1
                          QAccessibleTree::indexFromLogical: invalid index: 2 0 for LayersTreeWidget(0x4a69668, name = "treeWidget")
                          Cannot creat accessible child interface for object: LayersTreeWidget(0x4a69668, name = "treeWidget") index: 2
                          QAccessibleTree::indexFromLogical: invalid index: 2 0 for LayersTreeWidget(0x4a69668, name = "treeWidget")
                          Cannot creat accessible child interface for object: LayersTreeWidget(0x4a69668, name = "treeWidget") index: 2
                          First-chance exception at 0x74c2c41f in JOI_Editor.exe: 0x80010001: Вызов был отклонен.
                          QAccessibleTree::indexFromLogical: invalid index: 3 0 for LayersTreeWidget(0x4a69668, name = "treeWidget")
                          Cannot creat accessible child interface for object: LayersTreeWidget(0x4a69668, name = "treeWidget") index: 3
                          First-chance exception at 0x6631232a in JOI_Editor.exe: 0xC0000005: Access violation reading location 0x00000004.
                          Unhandled exception at 0x770815de in JOI_Editor.exe: 0xC0000005: Access violation reading location 0x00000004.
                          The program '[7544] JOI_Editor.exe: Native' has exited with code -1073741819 (0xc0000005).

                          1 Reply Last reply
                          0
                          • W Offline
                            W Offline
                            wizzhard
                            wrote on last edited by
                            #21

                            I have debugged a little in qt's code and there is something weird.

                            Before I rename an item everything works fine and the function QWindowsOleDropTarget::Drop qwindowsdrag.cpp 683 is called only when I release the mouse button over the item I want to do the drop on.
                            After I have renamed an item I start a drag, the dragEnterEvent occurs one time, then dragMoveEvent occurs one time too and the program crashes under QWindowsOleDropTarget::Drop qwindowsdrag.cpp 683 but I never released the button so this drop should not have occured.
                            If , after I renamed an item (so the app should crash the next time I drag an item in the treeview), I open an explorer windows, start to drag an item in it and press escape to cancel the drag then come back to my application and start a drag I don't crash and everything works fine.

                            I am on Windows 7 x64 with Qt 5.1.0 (vs2010)

                            QtCreator designer has a very similar problem, I can't drag widget from the toolbox until I canceled a drag with ESC in an explorer window. If I delete a widget in the designer the pb reappear and I must cancel a drag again in an explorer window.

                            1 Reply Last reply
                            0
                            • SGaistS Offline
                              SGaistS Offline
                              SGaist
                              Lifetime Qt Champion
                              wrote on last edited by
                              #22

                              Hi,

                              Can you write a little test program showing the problem ? You could then open a "bug report":http://bugreports.qt-project.org/issues/ with it

                              Interested in AI ? www.idiap.ch
                              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                              1 Reply Last reply
                              0
                              • S Offline
                                S Offline
                                smartopworks
                                wrote on last edited by
                                #23

                                The issue still exists in QT 5.2 for Ubuntu and it does not only affect QTreeView but also the QPlainTextEdit affected or others.

                                1 Reply Last reply
                                0
                                • S Offline
                                  S Offline
                                  smartopworks
                                  wrote on last edited by
                                  #24

                                  https://bugreports.qt-project.org/browse/QTBUG-33057

                                  I think it should be the same one.

                                  1 Reply Last reply
                                  0
                                  • J Offline
                                    J Offline
                                    jrondanv
                                    wrote on last edited by
                                    #25

                                    i have the same problem, in this link explain more about that.
                                    https://bugreports.qt-project.org/browse/QTBUG-33635?focusedCommentId=229983&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-229983

                                    1 Reply Last reply
                                    0

                                    • Login

                                    • Login or register to search.
                                    • First post
                                      Last post
                                    0
                                    • Categories
                                    • Recent
                                    • Tags
                                    • Popular
                                    • Users
                                    • Groups
                                    • Search
                                    • Get Qt Extensions
                                    • Unsolved