Browse Source

Open destination folders on macOS in separate thread

In some unknown way, the one line in Objective-C affects Qt's main
loop causing the crash in QApplication::exec() on processing next
event after that call.

Even crash doesn't happen exactly after this call, it will happen
on application exit. Call stack and disassembly are the same in
all cases.

But running that code in another thread solves the issue.
adaptive-webui-19844
Nick Korotysh 2 years ago
parent
commit
a93cd20e4d
No known key found for this signature in database
GPG Key ID: 7D0D4117C97CCC46
  1. 8
      src/gui/macutilities.mm

8
src/gui/macutilities.mm

@ -106,7 +106,15 @@ namespace MacUtils
for (const auto &path : pathList) for (const auto &path : pathList)
[pathURLs addObject:[NSURL fileURLWithPath:path.toString().toNSString()]]; [pathURLs addObject:[NSURL fileURLWithPath:path.toString().toNSString()]];
// In some unknown way, the next line affects Qt's main loop causing the crash
// in QApplication::exec() on processing next event after this call.
// Even crash doesn't happen exactly after this call, it will happen on
// application exit. Call stack and disassembly are the same in all cases.
// But running it in another thread (aka in background) solves the issue.
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^
{
[[NSWorkspace sharedWorkspace] activateFileViewerSelectingURLs:pathURLs]; [[NSWorkspace sharedWorkspace] activateFileViewerSelectingURLs:pathURLs];
});
} }
} }

Loading…
Cancel
Save