diff --git a/qrenderdoc/Code/QRDUtils.cpp b/qrenderdoc/Code/QRDUtils.cpp index 6f1ca1bac..8b5a36ba3 100644 --- a/qrenderdoc/Code/QRDUtils.cpp +++ b/qrenderdoc/Code/QRDUtils.cpp @@ -372,6 +372,11 @@ void GUIInvoke::call(const std::function &f) return; } + defer(f); +} + +void GUIInvoke::defer(const std::function &f) +{ GUIInvoke *invoke = new GUIInvoke(f); invoke->moveToThread(qApp->thread()); invoke->metaObject()->method(methodIndex).invoke(invoke, Qt::QueuedConnection); diff --git a/qrenderdoc/Code/QRDUtils.h b/qrenderdoc/Code/QRDUtils.h index 70ff9184b..27b183b64 100644 --- a/qrenderdoc/Code/QRDUtils.h +++ b/qrenderdoc/Code/QRDUtils.h @@ -177,6 +177,9 @@ public: static void blockcall(const std::function &f); static bool onUIThread(); + // same as call() above, but it doesn't check for an instant call on the UI thread + static void defer(const std::function &f); + protected slots: void doInvoke() { diff --git a/qrenderdoc/Windows/MainWindow.cpp b/qrenderdoc/Windows/MainWindow.cpp index a686683b9..01ff36a7a 100644 --- a/qrenderdoc/Windows/MainWindow.cpp +++ b/qrenderdoc/Windows/MainWindow.cpp @@ -1776,7 +1776,11 @@ void MainWindow::dropEvent(QDropEvent *event) { QString fn = dragFilename(event->mimeData()); if(!fn.isEmpty()) - LoadFromFilename(fn, false); + { + // we defer this so we can return immediately and unblock whichever application dropped the + // item. + GUIInvoke::defer([this, fn]() { LoadFromFilename(fn, false); }); + } } void MainWindow::LoadSaveLayout(QAction *action, bool save)