ivmx/cefpython

Mouse context menu and <select> control crash app on Mac

GoogleCodeExporter opened this issue · 3 comments

When right clicking on a page an error occurs with message that existing app 
does not conform to the required protocol (CrAppControlProtocol).

Error reported on the CEF Forum:
http://www.magpcss.org/ceforum/viewtopic.php?f=6&t=12560

The solution for now is to disable mouse context menu through 
ApplicationSettings.

Original issue reported on code.google.com by czarek.t...@gmail.com on 10 Jan 2015 at 5:06

The <select> control crashes app as well.

Original comment by czarek.t...@gmail.com on 10 Jan 2015 at 5:21

  • Changed title: Mouse context menu and control crash app on Mac
Marshall has responed on the CEF Forum:

    You need to provide a custom implementation of NSApplication that implements CrAppControlProtocol (see cef_application_mac.h). If Python implements NSApplication itself then you'll need to use a workaround similar to JCEF: https://code.google.com/p/javachromiumembedded/source/browse/trunk/src/native/util_mac.mm

Original comment by czarek.t...@gmail.com on 10 Jan 2015 at 5:38

Fixed in revision 8ca9a32e9103.

Overwriting NSApplication and swizzling methods worked. But it was also 
required to call NSApplication.sharedApplication(). For this purpose the 
MacInitialize() method was exposed and is called automatically by 
cefpython.Initialize().

There is one drawback for this approach. There appear errors in the console 
like this:

    [0111/193111:ERROR_REPORT:scoped_sending_event.mm(14)] Check failed: 
        [app_ conformsToProtocol:@protocol(CrAppControlProtocol)].

They are harmless. It might be possible to get rid of these errors by providing 
a direct CefAppProtocol implementation:

    @interface CEFPythonApplication : NSApplication<CefAppProtocol>

But the current implementation is more reliable. It will work even when some 
GUI library creates NSApplication implementation on its own. This was required 
in JCEF by Marshall. In wxPython this is not required, but it might be required 
for other GUI libraries.

Original comment by czarek.t...@gmail.com on 11 Jan 2015 at 7:02

  • Changed state: Fixed