storyboard reference loses menu

Originator:mayoff
Number:rdar://36837648 Date Originated:24-Jan-2018 03:44 PM
Status:Open Resolved:
Product:macOS + SDK Product Version:Xcode Version 9.2 (9C40b) / macOS 10.12.6 (16G1114)
Classification:Serious Bug Reproducible:Always
 
Summary:
Dear Xcoderinos and/or AppKitterinos,

I’m attaching a test project. It has a scene titled “Main Scene” and a scene titled “Popover Scene”. It also has storyboard reference named “popover Scene” that refers to the real “Popover Scene”.

In Popover Scene, there’s an NSMenu, and the root (and only) view of the scene has its menu outlet connected to that menu.

In Main Scene, there are two buttons: “Works Fine” and “Prints Error”.

The “Works Fine” button triggers a popover segue connected to the real Popover Scene. Clicking this button shows the popover, and right-clicking in the popover shows the menu.

The “Prints Error” button triggers a popover segue connected to the storyboard reference. Clicking this button shows the popover, but right-clicking in the popover does NOT show the menu. Clicking this button also prints the following messages to the console:

✂─────────────── console output starts
2018-01-24 15:30:29.575533-0600 menuExternalObjectError[18818:4145920] [Storyboard] ERROR: Placeholder for identifier 'UpstreamPlaceholder-H2A-u4-nbU' was set to '<NSMenu: 0x600000079900>
	Title: 
	Supermenu: 0x0 (None), autoenable: YES
	Items:     (
        "<NSMenuItem: 0x6000000a35a0 Item 1>",
        "<NSMenuItem: 0x6000000a30c0 Item 2>",
        "<NSMenuItem: 0x6000000a3600 Item 3>"
    )', but the object was deallocated. Is it missing a strong reference in the storyboard/nib?
2018-01-24 15:30:29.575670-0600 menuExternalObjectError[18818:4145920] Attempted to set object of class NSNibExternalObjectPlaceholder as the menu of a NSView (0x600000120e60).  Ignored.
✂─────────────── console output ends

Workaround (not shown in the test project): adding a strong IBOutlet to the Popover Scene’s view controller and connecting it to the menu fixes the problem.

Love,
Rob


Steps to Reproduce:
1. Run the test project.
2. Click the buttons.
3. Right-click the popovers.

Expected Results:
Context menus out the wazoo.

Actual Results:
Context menus not out the wazoo.

Version:
Xcode Version 9.2 (9C40b) / macOS 10.12.6 (16G1114)

Notes:

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!