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

same here

Experiencing the same issue in macOS 10.13.6 (17G5019) / XCode Version 10.1 (10B61).

Trying to add a button to the system status bar that triggers a popover. The popover's contentViewController is set to a ViewController instantiated from code from the Main storyboard. That ViewController has its own NSMenu for an NSTableView.

When I click the button in the system status bar and the popover is about to show I get:

[General] Placeholder for identifier 'UpstreamPlaceholder-fac-fe-Kyh' was set to ' Title: Supermenu: 0x0 (None), autoenable: YES Items: ( "", "", "", "" )', but the object was deallocated. Is it missing a strong reference in the storyboard/nib?

I'm using the same ViewController elsewhere in the app (via Storyboard segues) and it works fine. In this case however I get this issue all the time.

I was hoping that holding a strong reference for the Storyboard would help but that is not the case.

Adding a strong reference to the menu in the ViewController's code does indeed help but it doesn't feel right - it should not depend on whether the VC was instantiated via storyboard segues or manually added to a popover (unless I'm overlooking anything).

By norbert.mocsnik at Feb. 15, 2019, 6:13 p.m. (reply...)

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!