<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Crash with QDragManager]]></title><description><![CDATA[<p dir="auto">Dear all,</p>
<p dir="auto">I've an issue with the member <code>m_currentDropTarget</code> from the internal <code>QDragManager</code> instance.<br />
In my application, the user can open a <code>QMainWindow</code> and do some drag and drop between child widgets.</p>
<p dir="auto">After a successful drop, if the user closes the mainwindow and re-open it again, the next drag movement will lead to an exception because <code>m_currentDropTarget</code> is still pointing to a child widget of the destroyed window.</p>
<p dir="auto">Since this class is internal, I don't have any way to interact with it.<br />
Any tip on how to reset the internel state of the QDragManager ?</p>
<p dir="auto">Thanks by advance.</p>
]]></description><link>https://forum.qt.io/topic/88429/crash-with-qdragmanager</link><generator>RSS for Node</generator><lastBuildDate>Wed, 08 Apr 2026 12:10:32 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/88429.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 06 Mar 2018 08:59:04 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Crash with QDragManager on Tue, 06 Mar 2018 17:22:55 GMT]]></title><description><![CDATA[<p dir="auto">I've finaly fixed the issue.<br />
The problem came from an <code>eventfilter</code> set on all children of the mainwindow which managed all drag'n drop events. It was returning true in the drop event case (It manages the drop so it should return true, isn't it ???).<br />
Returning true was preventing the <code>QDragManager</code> to reset it's internal target.</p>
<p dir="auto">I've spent 2days debugging the program, and trying to understand the situation while the fix was just to return false instead of true in the <code>eventFilter</code>.<br />
Despite having carefuly read the doc on Drag'n drop management, I still have issue on how to manage drag'n drop correctly.</p>
<ol>
<li>I think it should be written somewhere in the documentation that eventFilter should return true in case of <code>QDropEvent</code></li>
<li>Why doesn't the <code>QDragManager</code> store a <code>QPointer</code> instead of a simple pointer to the target object ?</li>
</ol>
<p dir="auto">Regards</p>
]]></description><link>https://forum.qt.io/post/445586</link><guid isPermaLink="true">https://forum.qt.io/post/445586</guid><dc:creator><![CDATA[NicolasS]]></dc:creator><pubDate>Tue, 06 Mar 2018 17:22:55 GMT</pubDate></item><item><title><![CDATA[Reply to Crash with QDragManager on Wed, 07 Mar 2018 08:26:04 GMT]]></title><description><![CDATA[<p dir="auto">Sorry I wasn't very clear on that part.<br />
The <code>eventFilter</code> is installed on the toplevel parent of all children we want to monitor and is responsible to process the event on the adequat underlying child.<br />
One of the advantage of this design is that the code is centralized in one part so it's easier to maintain. Maybe there's other possible design but it works in our case.<br />
Except that I was tricked by the code to return from the <code>eventFilter</code>.</p>
]]></description><link>https://forum.qt.io/post/445715</link><guid isPermaLink="true">https://forum.qt.io/post/445715</guid><dc:creator><![CDATA[NicolasS]]></dc:creator><pubDate>Wed, 07 Mar 2018 08:26:04 GMT</pubDate></item><item><title><![CDATA[Reply to Crash with QDragManager on Tue, 06 Mar 2018 20:58:56 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/nicolass">@<bdi>NicolasS</bdi></a><br />
why do you install an event filter on all children for the drop event in the first place? o.O</p>
]]></description><link>https://forum.qt.io/post/445604</link><guid isPermaLink="true">https://forum.qt.io/post/445604</guid><dc:creator><![CDATA[raven-worx]]></dc:creator><pubDate>Tue, 06 Mar 2018 20:58:56 GMT</pubDate></item><item><title><![CDATA[Reply to Crash with QDragManager on Tue, 06 Mar 2018 17:22:55 GMT]]></title><description><![CDATA[<p dir="auto">I've finaly fixed the issue.<br />
The problem came from an <code>eventfilter</code> set on all children of the mainwindow which managed all drag'n drop events. It was returning true in the drop event case (It manages the drop so it should return true, isn't it ???).<br />
Returning true was preventing the <code>QDragManager</code> to reset it's internal target.</p>
<p dir="auto">I've spent 2days debugging the program, and trying to understand the situation while the fix was just to return false instead of true in the <code>eventFilter</code>.<br />
Despite having carefuly read the doc on Drag'n drop management, I still have issue on how to manage drag'n drop correctly.</p>
<ol>
<li>I think it should be written somewhere in the documentation that eventFilter should return true in case of <code>QDropEvent</code></li>
<li>Why doesn't the <code>QDragManager</code> store a <code>QPointer</code> instead of a simple pointer to the target object ?</li>
</ol>
<p dir="auto">Regards</p>
]]></description><link>https://forum.qt.io/post/445586</link><guid isPermaLink="true">https://forum.qt.io/post/445586</guid><dc:creator><![CDATA[NicolasS]]></dc:creator><pubDate>Tue, 06 Mar 2018 17:22:55 GMT</pubDate></item><item><title><![CDATA[Reply to Crash with QDragManager on Tue, 06 Mar 2018 14:17:31 GMT]]></title><description><![CDATA[<p dir="auto">Qt 5.9.4 (bug was already present in 5.8)<br />
Windows 10 64bits + Microsoft Visual 2017</p>
<p dir="auto">Hard for me to post a sample of code.</p>
<p dir="auto"><a href="https://ddgobkiprc33d.cloudfront.net/a1726a3e-ac1b-4670-bd31-43d92eb283ef.png" target="_blank" rel="noopener noreferrer nofollow ugc">Here's the line involving QDragManager </a></p>
<p dir="auto">Here's the call stack :</p>
<blockquote>
<p dir="auto">Qt5Cored.dll!QObject::isWidgetType() Line 147	C++	Symbols loaded.<br />
Qt5Widgetsd.dll!qobject_cast&lt;QWidget * __ptr64&gt;(QObject * o) Line 741	C++	Symbols loaded.<br />
Qt5Widgetsd.dll!QApplication::notify(QObject * receiver, QEvent * e) Line 3468	C++	Symbols loaded.<br />
Qt5Cored.dll!QCoreApplication::notifyInternal2(QObject * receiver, QEvent * event) Line 1016	C++	Symbols loaded.<br />
Qt5Cored.dll!QCoreApplication::sendSpontaneousEvent(QObject * receiver, QEvent * event) Line 236	C++	Symbols loaded.<br />
Qt5Widgetsd.dll!QWidgetWindow::handleDragEnterMoveEvent(QDragMoveEvent * event) Line 855	C++	Symbols loaded.<br />
Qt5Widgetsd.dll!QWidgetWindow::event(QEvent * event) Line 285	C++	Symbols loaded.<br />
Qt5Widgetsd.dll!QApplicationPrivate::notify_helper(QObject * receiver, QEvent * e) Line 3722	C++	Symbols loaded.<br />
Qt5Widgetsd.dll!QApplication::notify(QObject * receiver, QEvent * e) Line 3094	C++	Symbols loaded.<br />
Qt5Cored.dll!QCoreApplication::notifyInternal2(QObject * receiver, QEvent * event) Line 1016	C++	Symbols loaded.<br />
Qt5Cored.dll!QCoreApplication::sendEvent(QObject * receiver, QEvent * event) Line 233	C++	Symbols loaded.<br />
Qt5Guid.dll!QGuiApplicationPrivate::processDrag(QWindow * w, const QMimeData * dropData, const QPoint &amp; p, QFlags&lt;enum Qt::DropAction&gt; supportedActions) Line 2922	C++	Symbols loaded.<br />
Qt5Guid.dll!QWindowSystemInterface::handleDrag(QWindow * window, const QMimeData * dropData, const QPoint &amp; p, QFlags&lt;enum Qt::DropAction&gt; supportedActions) Line 716	C++	Symbols loaded.<br />
qwindowsd.dll!QWindowsOleDropTarget::handleDrag(QWindow * window, unsigned long grfKeyState, const QPoint &amp; point, unsigned long * pdwEffect) Line 555	C++	Symbols loaded.<br />
qwindowsd.dll!QWindowsOleDropTarget::DragOver(unsigned long grfKeyState, _POINTL pt, unsigned long * pdwEffect) Line 606	C++	Symbols loaded.<br />
[External Code]		Annotated Frame<br />
qwindowsd.dll!QWindowsDrag::drag(QDrag * drag) Line 748	C++	Symbols loaded.<br />
Qt5Guid.dll!QDragManager::drag(QDrag * o) Line 141	C++	Symbols loaded.<br />
Qt5Guid.dll!QDrag::exec(QFlags&lt;enum Qt::DropAction&gt; supportedActions, Qt::DropAction defaultDropAction) Line 284	C++	Symbols loaded.<br />
Qt5Widgetsd.dll!QAbstractItemView::startDrag(QFlags&lt;enum Qt::DropAction&gt; supportedActions) Line 3679	C++	Symbols loaded.<br />
Qt5Widgetsd.dll!QAbstractItemView::mouseMoveEvent(QMouseEvent * event) Line 1837	C++	Symbols loaded.<br />
Qt5Widgetsd.dll!QTreeView::mouseMoveEvent(QMouseEvent * event) Line 1990	C++	Symbols loaded.<br />
Qt5Widgetsd.dll!QWidget::event(QEvent * event) Line 8892	C++	Symbols loaded.<br />
Qt5Widgetsd.dll!QFrame::event(QEvent * e) Line 550	C++	Symbols loaded.<br />
Qt5Widgetsd.dll!QAbstractScrollArea::viewportEvent(QEvent * e) Line 1221	C++	Symbols loaded.<br />
Qt5Widgetsd.dll!QAbstractItemView::viewportEvent(QEvent * event) Line 1749	C++	Symbols loaded.<br />
Qt5Widgetsd.dll!QTreeView::viewportEvent(QEvent * event) Line 1327	C++	Symbols loaded.<br />
Qt5Widgetsd.dll!QAbstractScrollAreaPrivate::viewportEvent(QEvent * event) Line 113	C++	Symbols loaded.<br />
Qt5Widgetsd.dll!QAbstractScrollAreaFilter::eventFilter(QObject * o, QEvent * e) Line 129	C++	Symbols loaded.<br />
Qt5Cored.dll!QCoreApplicationPrivate::sendThroughObjectEventFilters(QObject * receiver, QEvent * event) Line 1127	C++	Symbols loaded.<br />
Qt5Widgetsd.dll!QApplicationPrivate::notify_helper(QObject * receiver, QEvent * e) Line 3718	C++	Symbols loaded.<br />
Qt5Widgetsd.dll!QApplication::notify(QObject * receiver, QEvent * e) Line 3198	C++	Symbols loaded.<br />
Qt5Cored.dll!QCoreApplication::notifyInternal2(QObject * receiver, QEvent * event) Line 1016	C++	Symbols loaded.<br />
Qt5Cored.dll!QCoreApplication::sendSpontaneousEvent(QObject * receiver, QEvent * event) Line 236	C++	Symbols loaded.<br />
Qt5Widgetsd.dll!QApplicationPrivate::sendMouseEvent(QWidget * receiver, QMouseEvent * event, QWidget * alienWidget, QWidget * nativeWidget, QWidget * * buttonDown, QPointer&lt;QWidget&gt; &amp; lastMouseReceiver, bool spontaneous) Line 2702	C++	Symbols loaded.<br />
Qt5Widgetsd.dll!QWidgetWindow::handleMouseEvent(QMouseEvent * event) Line 630	C++	Symbols loaded.<br />
Qt5Widgetsd.dll!QWidgetWindow::event(QEvent * event) Line 251	C++	Symbols loaded.<br />
Qt5Widgetsd.dll!QApplicationPrivate::notify_helper(QObject * receiver, QEvent * e) Line 3722	C++	Symbols loaded.<br />
Qt5Widgetsd.dll!QApplication::notify(QObject * receiver, QEvent * e) Line 3094	C++	Symbols loaded.<br />
Qt5Cored.dll!QCoreApplication::notifyInternal2(QObject * receiver, QEvent * event) Line 1016	C++	Symbols loaded.<br />
Qt5Cored.dll!QCoreApplication::sendSpontaneousEvent(QObject * receiver, QEvent * event) Line 236	C++	Symbols loaded.<br />
Qt5Guid.dll!QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent * e) Line 1953	C++	Symbols loaded.<br />
Qt5Guid.dll!QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent * e) Line 1734	C++	Symbols loaded.<br />
Qt5Guid.dll!QWindowSystemInterface::sendWindowSystemEvents(QFlags&lt;enum QEventLoop::ProcessEventsFlag&gt; flags) Line 952	C++	Symbols loaded.<br />
qwindowsd.dll!QWindowsGuiEventDispatcher::sendPostedEvents() Line 83	C++	Symbols loaded.</p>
</blockquote>
]]></description><link>https://forum.qt.io/post/445543</link><guid isPermaLink="true">https://forum.qt.io/post/445543</guid><dc:creator><![CDATA[NicolasS]]></dc:creator><pubDate>Tue, 06 Mar 2018 14:17:31 GMT</pubDate></item><item><title><![CDATA[Reply to Crash with QDragManager on Tue, 06 Mar 2018 13:52:42 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/nicolass">@<bdi>NicolasS</bdi></a><br />
Qt version?<br />
Platform?<br />
System?<br />
Some DnD code?</p>
]]></description><link>https://forum.qt.io/post/445536</link><guid isPermaLink="true">https://forum.qt.io/post/445536</guid><dc:creator><![CDATA[raven-worx]]></dc:creator><pubDate>Tue, 06 Mar 2018 13:52:42 GMT</pubDate></item></channel></rss>