OS X: Need a NSView but fl_xid returns a NSWindow?

28 views
Skip to first unread message

monocasual laboratories

unread,
Feb 27, 2016, 11:36:17 AM2/27/16
to fltk.general
Hello FLTK team,

I'm trying to display a VST plugin's graphical interface inside a FLTK application. The theory is quite trivial: create an empty Fl_Window and pass the plugin a reference to the underlying native window (with fl_xid(...)). The plugin then uses that reference to draw its GUI internally. 

That works great on Windows and Linux, but I keep getting nasty crashes on OS X: 

2016-02-27 06:48:44.129 t[393:f0b] -[FLWindow window]: unrecognized selector sent to instance 0x102b79b10
2016-02-27 06:48:44.132 t[393:f0b] An uncaught exception was raised
2016-02-27 06:48:44.133 t[393:f0b] -[FLWindow window]: unrecognized selector sent to instance 0x102b79b10
2016-02-27 06:48:44.148 t[393:f0b] (
0   CoreFoundation                      0x00007fff880480a6 __exceptionPreprocess + 198
1   libobjc.A.dylib                     0x00007fff8726c3f0 objc_exception_throw + 43
2   CoreFoundation                      0x00007fff880de6ea -[NSObject(NSObject) doesNotRecognizeSelector:] + 186
3   CoreFoundation                      0x00007fff880365ce ___forwarding___ + 414
4   CoreFoundation                      0x00007fff880363b8 _CF_forwarding_prep_0 + 232
5   t                                   0x000000010038597d _ZN4juce19NSViewComponentPeerC2ERNS_9ComponentEiP6NSView + 941
6   t                                   0x000000010033acbb _ZN4juce19NSViewComponentPeerC1ERNS_9ComponentEiP6NSView + 43
7   t                                   0x000000010030f505 _ZN4juce9Component13createNewPeerEiPv + 85
8   t                                   0x000000010025456c _ZN4juce9Component12addToDesktopEiPv + 924
9   t                                   0x00000001000020b6 _Z15openGUIcallbackP9Fl_WidgetPv + 246
10  t                                   0x000000010043607a _ZN9Fl_Widget11do_callbackEPS_Pv + 40
11  t                                   0x0000000100418dec _ZN9Fl_Button6handleEi + 646
12  t                                   0x0000000100417373 _ZL4sendiP9Fl_WidgetP9Fl_Window + 135
13  t                                   0x0000000100416d05 _ZN2Fl7handle_EiP9Fl_Window + 257
14  t                                   0x000000010040e37a _ZL17cocoaMouseHandlerP7NSEvent + 726
15  AppKit                              0x00007fff84d4c6d6 -[NSWindow sendEvent:] + 7053
16  AppKit                              0x00007fff84d48744 -[NSApplication sendEvent:] + 5761
17  t                                   0x000000010040e094 +[FLApplication sendEvent:] + 392
18  t                                   0x000000010040cfba _Z7fl_waitd + 185
19  t                                   0x000000010040d067 _Z21fl_mac_flush_and_waitd + 151
20  t                                   0x00000001004164bf _ZN2Fl3runEv + 19
21  t                                   0x0000000100001e5f main + 1199
22  libdyld.dylib                       0x00007fff8c2a27e1 start + 0
23  ???                                 0x0000000000000001 0x0 + 1
)
2016-02-27 06:48:44.149 t[393:f0b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[FLWindow window]: unrecognized selector sent to instance 0x102b79b10'
*** First throw call stack:
(
0   CoreFoundation                      0x00007fff880480a6 __exceptionPreprocess + 198
1   libobjc.A.dylib                     0x00007fff8726c3f0 objc_exception_throw + 43
2   CoreFoundation                      0x00007fff880de6ea -[NSObject(NSObject) doesNotRecognizeSelector:] + 186
3   CoreFoundation                      0x00007fff880365ce ___forwarding___ + 414
4   CoreFoundation                      0x00007fff880363b8 _CF_forwarding_prep_0 + 232
5   t                                   0x000000010038597d _ZN4juce19NSViewComponentPeerC2ERNS_9ComponentEiP6NSView + 941
6   t                                   0x000000010033acbb _ZN4juce19NSViewComponentPeerC1ERNS_9ComponentEiP6NSView + 43
7   t                                   0x000000010030f505 _ZN4juce9Component13createNewPeerEiPv + 85
8   t                                   0x000000010025456c _ZN4juce9Component12addToDesktopEiPv + 924
9   t                                   0x00000001000020b6 _Z15openGUIcallbackP9Fl_WidgetPv + 246
10  t                                   0x000000010043607a _ZN9Fl_Widget11do_callbackEPS_Pv + 40
11  t                                   0x0000000100418dec _ZN9Fl_Button6handleEi + 646
12  t                                   0x0000000100417373 _ZL4sendiP9Fl_WidgetP9Fl_Window + 135
13  t                                   0x0000000100416d05 _ZN2Fl7handle_EiP9Fl_Window + 257
14  t                                   0x000000010040e37a _ZL17cocoaMouseHandlerP7NSEvent + 726
15  AppKit                              0x00007fff84d4c6d6 -[NSWindow sendEvent:] + 7053
16  AppKit                              0x00007fff84d48744 -[NSApplication sendEvent:] + 5761
17  t                                   0x000000010040e094 +[FLApplication sendEvent:] + 392
18  t                                   0x000000010040cfba _Z7fl_waitd + 185
19  t                                   0x000000010040d067 _Z21fl_mac_flush_and_waitd + 151
20  t                                   0x00000001004164bf _ZN2Fl3runEv + 19
21  t                                   0x0000000100001e5f main + 1199
22  libdyld.dylib                       0x00007fff8c2a27e1 start + 0
23  ???                                 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminate called throwing an exception
Process 393 stopped


Here are my assumptions: In OSX/Cocoa land VST plugins require a reference to NSView, but unfortunately fl_xid() seems to return a reference to NSWindow. Am I on the right track (for the fl_xid part, of course)? If so, I will figure out what's the best/proper way for that conversion. 

Thanks in advance for your help and for your great library!




Kevin "Ingwie Phoenix" Ingwersen

unread,
Feb 27, 2016, 12:01:36 PM2/27/16
to fltkg...@googlegroups.com
--
You received this message because you are subscribed to the Google Groups "fltk.general" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fltkgeneral...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages