NSViewComponentPeer constructor "addObserver" calls have null window


#1

Hello,

I believe this is a bug in juce_mac_NSViewComponentPeer.mm. The NSViewComponentPeer constructor makes several calls similar to:

        [notificationCenter  addObserver: view
                                selector: @selector (frameChanged:)
                                    name: NSWindowDidMoveNotification
                                  object: window];

However, this code is before the window is created, so window is nullptr at the time. The effect of this is that every NSViewComponentPeer instance is notified every time a single window is moved. These addObserver calls should probably be moved to the bottom of the NSViewComponentPeer constructor.

Thanks,
Rob


#2

Thanks Rob, I’ll get that sorted.


#3

Great, thanks!