• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Sometimes all my menus are disabled
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Sometimes all my menus are disabled


  • Subject: Re: Sometimes all my menus are disabled
  • From: じょいすじょん <email@hidden>
  • Date: Tue, 14 Feb 2017 00:40:21 +0900

You have a lot of dupes in your nib file connections.

For example, select the AppDelegate in the nib in IB, and look at the Connections Inspector.
You'll see it has 2 Main Menu referencing outlets.
So it's hitting a random one of the two.
You have this kind of duplication in lots of places in your nib.
Rewire your nib.

> On Feb 13, 2017, at 23:12, Andreas Falkenhahn <email@hidden> wrote:
>
> On 12.02.2017 at 21:49 Kyle Sluder wrote:
>
>> There are plenty of ways to write refcounting bugs. But the
>> refcounting bug is just a theory. All we know for sure is that
>> something is disabling the menu items. I assume you have not turned
>> off the default autoenablesItems property on the menu, so that leaves a few possibilities:
>
>> 1. The target of your menu items is being replaced with an object
>> that does not respond to -menuClick:.
>> 2. The target of your menu items is being deallocated, and a new
>> object is being allocated in its place that does not respond to -menuClick:.
>> 3. The target of your menu items is being deallocated, and
>> NSMenuItem’s weak target pointer is being nilled out (special case of #1).
>> 4. The menu has a delegate, and it implements of one of the menu
>> update callbacks to disable the menu items.
>> 5. Some arbitrary object in your app is grabbing a reference to the menu items and disabling them.
>
> Thanks for the feedback. Unfortunately, I'm pretty much out of ideas now.
>
> I started cutting down my program to the absolute minimum to see if the
> error would go away. Well, it didn't. This is the code that's left of my
> program now:
>
> 	#import "AppDelegate.h"
>
> 	@implementation AppDelegate
> 	- (void) clickButton:(id)sender {}
> 	- (void) menuClick:(id)sender {}
> 	- (void) applicationDidFinishLaunching:(NSNotification *) aNotification
> 	{
> 		[mainWindow makeKeyAndOrderFront:nil];
> 	}
> 	@end
>
>       ----
>
> 	#import <Cocoa/Cocoa.h>
>
> 	int main(int argc, char *argv[])
> 	{
>       	return NSApplicationMain(argc, argv);
> 	}
>
> And the error is still there. Bottom line: The error must be in the
> MainMenu.nib or in the Xcode project. Maybe Xcode has messed up one of
> the files when migrating it from the old Xcode on PowerPC to Xcode 8.
>
> Unfortunately, I don't know where to look because I remember nothing about
> Interface Builder. That's why I have uploaded a VERY SMALL test project
> here: http://www.falkenhahn.com/tmp/guitest.tar.gz
>
> It really only contains the code quoted above, a single window with a
> single button and the original menu bar that is behaving erratically.
>
> As I said in my first mail, the really confusing fact is that it usually
> works just fine. But in every 3rd attempt or so suddenly all menus are
> disabled and I have no idea what's going on! It is really weird but it
> is clearly reproducible. I know I said before that it fails in 1 out of 10
> attempts but it's more like 1 in 3 attempts. It's really clearly reproducible.
> It happens all the time though not always.
>
> As I'm really out of ideas now I'd be extremely glad if somebody with
> IB experience could just take a quick look at this project and maybe come up
> with an explanation. As I said, it's an absolutely minimal project.
> It should be really straightforward to analyze for people who are experienced
> with IB.
>
> Thanks a lot for any help!
>
> --
> Best regards,
> Andreas Falkenhahn                            mailto:email@hidden
>
>
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden


_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


  • Follow-Ups:
    • Re: Sometimes all my menus are disabled
      • From: Andreas Falkenhahn <email@hidden>
References: 
 >Sometimes all my menus are disabled (From: Andreas Falkenhahn <email@hidden>)
 >Re: Sometimes all my menus are disabled (From: Kyle Sluder <email@hidden>)
 >Re: Sometimes all my menus are disabled (From: Andreas Falkenhahn <email@hidden>)
 >Re: Sometimes all my menus are disabled (From: Andreas Falkenhahn <email@hidden>)

  • Prev by Date: Re: Sometimes all my menus are disabled
  • Next by Date: Re: Sometimes all my menus are disabled
  • Previous by thread: Re: Sometimes all my menus are disabled
  • Next by thread: Re: Sometimes all my menus are disabled
  • Index(es):
    • Date
    • Thread