Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
5.15.2
-
None
Description
When Qt-based application is run as a plug-in to another host application on Mac OS, pressing Cmd+C/Cmd+X/Cmd+V/Cmd+A in Qt dialog causes an unhandled exception and crash.
In our case the host application is the Final Cut Pro which has its own Cmd+C/Cmd+X/Cmd+V/Cmd+A handlers in place.
We've noticed that inside qnsview_menus.mm the copy:/cut:/paste:/selectAll: all have special handling. See for ex. selectorIsCutCopyPaste(SEL selector) and its usage in - respondsToSelector(), methodSignatureForSelector() and forwardInvocation().
What seems to happen in our scenario is that Cmd+C/Cmd+X/Cmd+V/Cmd+A produces a copy:/cut:/paste:/selectAll: selector that is correctly recognized as such by selectorIsCutCopyPaste(), however its origin is not a QCocoaNSMenuItem as Qt code expects. Hence it ends up in forwardInvocation > super forwardInvocation and crashes the plug-in and the host application.
This seems to be related to the discussion in QTBUG-17291, however the corresponding code is not in Qt 5.15 any more.
Is this special handling of copy:/cut:/paste:/selectAll: needed at all? We've noticed that just unconditionally returning "false" from selectorIsCutCopyPaste() fixes the crash and does not break Cmd+C/Cmd+X/Cmd+V/Cmd+A functionality. This simple "fix" is what we are going to use for now until you guys come up with a better solution.