Re: Sometimes all my menus are disabled

2017-02-13 Thread Graham Cox

> On 14 Feb 2017, at 3:58 AM, Andreas Falkenhahn  wrote:
> 
> This annoying issue is just another reason why I prefer doing things in code.
> This has already cost me hours over hours and it's still not solved.

> True, I can see that. But how do I rewire my nib? I don't remember anything
> about Interface Builder. 


The problem here is that you seem unwilling to take a little time to learn the 
basics of Interface Builder. Don’t you think that would be time better spent 
than beating for hours on a problem that would take a developer experienced 
with IB a few minutes?

You cannot program effectively using Cocoa without knowing how to use IB. The 
POINT of IB is to save you having to spend hours coding to set up simple 
interfaces.

Someone has to point out the elephant in this particular room.

—Graham




___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Sometimes all my menus are disabled

2017-02-13 Thread Gary L. Wade
Well, you may have a valid bug to report to Apple.  You probably would want to 
use a tech support incident, which will get feedback faster, and in the past, 
when the issue turned out to be Apple’s bug, they’ve credited it back to me.  
Otherwise, definitely mark this as a serious bug.
--
Gary L. Wade
http://www.garywade.com/ 
> On Feb 13, 2017, at 12:54 PM, Andreas Falkenhahn  
> wrote:
> 
> On 13.02.2017 at 19:49 Gary L. Wade wrote:
> 
>> Your assignments for the File’s Owner and Application objects are
>> messed up.  First, clear the custom class values for these two
>> objects.  After that, connect the delegate outlet in the Application
>> object to your embedded AppDelegate object.
> 
> Thanks, but unfortunately, this doesn't help either (or I did it wrong).
> 
> Here's what I did:
> 
> 1) Select File's Owner, go to Custom Class section in the Identity
> inspector, delete what was inside the "Class" text field; the
> "Class" text field is now empty but Xcode shows "NSObject" in
> gray (indicating that this is probably the default)
> 
> 2) Select Application, and repeat the steps from above; the "Class"
> text field for Application is now empty as well and Xcode shows
> "NSApplication" in gray 
> 
> 3) Then I changed to the Connections inspector for Application,
> held down CMD and dragged the "delegate" item in the "Outlets"
> section to my AppDelegate object; thus, it now shows
> "delegate: AppDelegate" in the Connections inspector
> 
> However, as I said, the menus are still disabled in every 3rd
> attempt or so :( It's really a frustrating experience. Such a
> simple project, so much pain!
> 
> Any other ideas? 
> 
> -- 
> Best regards,
> Andreas Falkenhahnmailto:andr...@falkenhahn.com
> 

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Sometimes all my menus are disabled

2017-02-13 Thread Andreas Falkenhahn
On 13.02.2017 at 19:49 Gary L. Wade wrote:

> Your assignments for the File’s Owner and Application objects are
> messed up.  First, clear the custom class values for these two
> objects.  After that, connect the delegate outlet in the Application
> object to your embedded AppDelegate object.

Thanks, but unfortunately, this doesn't help either (or I did it wrong).

Here's what I did:

1) Select File's Owner, go to Custom Class section in the Identity
inspector, delete what was inside the "Class" text field; the
"Class" text field is now empty but Xcode shows "NSObject" in
gray (indicating that this is probably the default)

2) Select Application, and repeat the steps from above; the "Class"
text field for Application is now empty as well and Xcode shows
"NSApplication" in gray 

3) Then I changed to the Connections inspector for Application,
held down CMD and dragged the "delegate" item in the "Outlets"
section to my AppDelegate object; thus, it now shows
"delegate: AppDelegate" in the Connections inspector

However, as I said, the menus are still disabled in every 3rd
attempt or so :( It's really a frustrating experience. Such a
simple project, so much pain!

Any other ideas? 

-- 
Best regards,
 Andreas Falkenhahnmailto:andr...@falkenhahn.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Sometimes all my menus are disabled

2017-02-13 Thread Gary L. Wade
Your assignments for the File’s Owner and Application objects are messed up.  
First, clear the custom class values for these two objects.  After that, 
connect the delegate outlet in the Application object to your embedded 
AppDelegate object.
--
Gary L. Wade
http://www.garywade.com/ 
> On Feb 13, 2017, at 9:41 AM, Andreas Falkenhahn  
> wrote:
> 
> On 13.02.2017 at 18:16 Gary L. Wade wrote:
> 
>> I haven't looked at your NIB, but I've seen something of what's
>> described with errant choices of diff tools and source code merging,
> 
> That certainly can't be the case since I'm not using any diff or
> merging tools. It's also just a single developer project, i.e.
> I'm the only one working on it. 
> 
>> usually when a user just accepts a merge without eyeballing it. If
>> you've got a history of your revisions, you should find where things
>> changed badly. Also, if you've got a built app that works, I
>> remember being able to add some extra things on older NIBs to make
>> them openable in Interface Builder, but that was a really long time ago.
> 
> Unfortunately, I don't have a history of revisions. All I can say is
> that the error doesn't occur with the old Xcode on the PowerPC Mac
> running 10.5 and also it doesn't occur with Xcode 3.2 on my x86 Mac
> running 10.6. It does, however, occur in 10.12 using the latest Xcode.
> 
> But, the project that I've uploaded to 
> http://www.falkenhahn.com/tmp/guitest.tar.gz 
> is really ridiculously simple. It's just a window, a button, and a
> menu bar. That's all. Is really nobody here able to fix this project
> *without* re-creating it from scratch? It's just a few kilobytes of
> XML after all... 
> 
> -- 
> Best regards,
> Andreas Falkenhahnmailto:andr...@falkenhahn.com
> 

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Sometimes all my menus are disabled

2017-02-13 Thread Andreas Falkenhahn
On 13.02.2017 at 18:16 Gary L. Wade wrote:

> I haven't looked at your NIB, but I've seen something of what's
> described with errant choices of diff tools and source code merging,

That certainly can't be the case since I'm not using any diff or
merging tools. It's also just a single developer project, i.e.
I'm the only one working on it. 

> usually when a user just accepts a merge without eyeballing it. If
> you've got a history of your revisions, you should find where things
> changed badly. Also, if you've got a built app that works, I
> remember being able to add some extra things on older NIBs to make
> them openable in Interface Builder, but that was a really long time ago.

Unfortunately, I don't have a history of revisions. All I can say is
that the error doesn't occur with the old Xcode on the PowerPC Mac
running 10.5 and also it doesn't occur with Xcode 3.2 on my x86 Mac
running 10.6. It does, however, occur in 10.12 using the latest Xcode.

But, the project that I've uploaded to 
http://www.falkenhahn.com/tmp/guitest.tar.gz 
is really ridiculously simple. It's just a window, a button, and a
menu bar. That's all. Is really nobody here able to fix this project
*without* re-creating it from scratch? It's just a few kilobytes of
XML after all... 

-- 
Best regards,
 Andreas Falkenhahnmailto:andr...@falkenhahn.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Sometimes all my menus are disabled

2017-02-13 Thread Gary L. Wade
I haven't looked at your NIB, but I've seen something of what's described with 
errant choices of diff tools and source code merging, usually when a user just 
accepts a merge without eyeballing it. If you've got a history of your 
revisions, you should find where things changed badly. Also, if you've got a 
built app that works, I remember being able to add some extra things on older 
NIBs to make them openable in Interface Builder, but that was a really long 
time ago.

When editing the text of a NIB, you have to be really careful with internal 
identifiers, which are essentially freeze-dried pointers within the NIB, and 
this may be why your forensic work is failing. When I've had to resort to this 
(nowadays in cases of auto layout mainly) I let Apple know that this is the 
only way I could do this or that.

Basically, try to find your oldest working version and go forward with that. If 
you can compare a working vs immediately non-working, that's even better.
--
Gary L. Wade (Sent from my iPhone)
http://www.garywade.com/

> On Feb 13, 2017, at 8:58 AM, Andreas Falkenhahn  
> wrote:
> 
>> On 13.02.2017 at 17:33 じょいすじょん wrote:
>> 
>> Yeah, my first suggestion didn't work, but points out the problem overall in 
>> you nib.
>> Looks like somebody did try to edit the xml before and munged it.
> 
> I certainly did not mess with the XML! Xcode must have messed this up when 
> converting
> the nib file from the old Xcode PowerPC project format to the new one. 
> 
>> You also have nested menu duplicates inside your menus in the nib file 
>> itself!
> 
>> MainMenu
>>Hollywood
>>Menu
>>About Hollywood
>>Separator
>>MainMenu (duplicated here as sub menu...)
>>Preferences
>>... (and on)
> 
> 
>> Delete that other MainMenu inside and it seems to work thus far.
> 
> I've removed the complete duplicate MainMenu tree (the one after the separator
> item, see above) from designable.nib using a text editor. However, it still
> doesn't work. Same behaviour as before. 
> 
> 
> 
> This annoying issue is just another reason why I prefer doing things in code.
> This has already cost me hours over hours and it's still not solved. Even
> worse, there's a profound feeling of helplessness in the air. And re-creating
> everything from scratch is not an option! I certainly did not mess with the
> XML. Xcode must have messed this up when converting the project from the
> old format to the new one. All such things wouldn't be possible with code.
> Code could be cleanly adapted to new designs while nobody can tell what black
> magic is going on inside those arcane nib files. It's quite depressing. $0.02
> 
> 
> 
> -- 
> Best regards,
> Andreas Falkenhahnmailto:andr...@falkenhahn.com
> 


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Sometimes all my menus are disabled

2017-02-13 Thread Andreas Falkenhahn
On 13.02.2017 at 17:33 じょいすじょん wrote:

> Yeah, my first suggestion didn't work, but points out the problem overall in 
> you nib.
> Looks like somebody did try to edit the xml before and munged it.

I certainly did not mess with the XML! Xcode must have messed this up when 
converting
the nib file from the old Xcode PowerPC project format to the new one. 

> You also have nested menu duplicates inside your menus in the nib file itself!

> MainMenu
> Hollywood
> Menu
> About Hollywood
> Separator
> MainMenu (duplicated here as sub menu...)
> Preferences
> ... (and on)


> Delete that other MainMenu inside and it seems to work thus far.

I've removed the complete duplicate MainMenu tree (the one after the separator
item, see above) from designable.nib using a text editor. However, it still
doesn't work. Same behaviour as before. 



This annoying issue is just another reason why I prefer doing things in code.
This has already cost me hours over hours and it's still not solved. Even
worse, there's a profound feeling of helplessness in the air. And re-creating
everything from scratch is not an option! I certainly did not mess with the
XML. Xcode must have messed this up when converting the project from the
old format to the new one. All such things wouldn't be possible with code.
Code could be cleanly adapted to new designs while nobody can tell what black
magic is going on inside those arcane nib files. It's quite depressing. $0.02



-- 
Best regards,
 Andreas Falkenhahnmailto:andr...@falkenhahn.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Sometimes all my menus are disabled

2017-02-13 Thread M Pulis
Consider getting an old PowerPC Mac, run your app as a blueprint and  
rebuild a new interface in the current Xcode. That will likely be  
faster than hacking away at your current nib, and a bit of fun as  
well. Take it one window at a time so you understand what is happening.


That is how we brought our 1983 to 1995 Lisa -> MPW -> CodeWarrior  
Pascal app into the current century and ended up with a nice clean UI  
and Objective C.


Good Luck!

Gary


On Feb 13, 2017, at 8:56 AM, Andreas Falkenhahn wrote:


On 13.02.2017 at 16:40 じょいすじょん wrote:


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.


True, I can see that. But how do I rewire my nib? I don't remember  
anything
about Interface Builder. As I said, I last worked on this project  
about 10

years ago on a PowerPC Mac.

So what exactly do I have to do? I've tried deleting the duplicate  
"mainMenu"

entry in "Referencing Outlets" but this didn't change anything...

--
Best regards,
Andreas Falkenhahnmailto:andr...@falkenhahn.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/toothpic%40fastq.com

This email sent to tooth...@fastq.com



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Sometimes all my menus are disabled

2017-02-13 Thread じょいすじょん
Yeah, my first suggestion didn't work, but points out the problem overall in 
you nib.
Looks like somebody did try to edit the xml before and munged it.

You also have nested menu duplicates inside your menus in the nib file itself!

MainMenu
Hollywood
Menu
About Hollywood
Separator
MainMenu (duplicated here as sub menu...)
Preferences
... (and on)


Delete that other MainMenu inside and it seems to work thus far.


> On Feb 14, 2017, at 0:56, Andreas Falkenhahn  wrote:
> 
> On 13.02.2017 at 16:40 じょいすじょん wrote:
> 
>> 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.
> 
> True, I can see that. But how do I rewire my nib? I don't remember anything
> about Interface Builder. As I said, I last worked on this project about 10
> years ago on a PowerPC Mac.
> 
> So what exactly do I have to do? I've tried deleting the duplicate "mainMenu"
> entry in "Referencing Outlets" but this didn't change anything...
> 
> -- 
> Best regards,
> Andreas Falkenhahnmailto:andr...@falkenhahn.com
> 


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Sometimes all my menus are disabled

2017-02-13 Thread Andreas Falkenhahn
On 13.02.2017 at 16:40 じょいすじょん wrote:

> 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.

True, I can see that. But how do I rewire my nib? I don't remember anything
about Interface Builder. As I said, I last worked on this project about 10
years ago on a PowerPC Mac.

So what exactly do I have to do? I've tried deleting the duplicate "mainMenu"
entry in "Referencing Outlets" but this didn't change anything...

-- 
Best regards,
 Andreas Falkenhahnmailto:andr...@falkenhahn.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Sometimes all my menus are disabled

2017-02-13 Thread Andreas Falkenhahn
On 13.02.2017 at 16:34 Steve Mills wrote:

> I've dinked around with it a bit more and ended up replacing
> MainMenu.nib with a new MainMenu.xib. That fixes it. I'm on an older
> Xcode now, so I can't open your MainMenu.nib, so I opened its
> designable.nib with a text editor to see if there's anything
> obvious. One thing that's really weird is that all the menus for the
> menubar are also duplicated as submenu items of the first separator
> after the About item. Although it's not an exact copy, since Plugins
> doesn't appear in that version of the app menu.

> So yeah, make a new xib and throw the old one out.

Oh, but that's a lot of work. My original MainMenu.nib contains lots
of windows. Recreating all of them is quite a major effort. Can't this
be fixed with a text editor somehow? :-)

-- 
Best regards,
 Andreas Falkenhahnmailto:andr...@falkenhahn.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Sometimes all my menus are disabled

2017-02-13 Thread じょいすじょん
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  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 
> 
>   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 Falkenhahnmailto:andr...@falkenhahn.com
> 
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> 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:
> https://lists.apple.com/mailman/options/cocoa-dev/dangerwillrobinsondanger%40gmail.com
> 
> This email sent to dangerwillrobinsondan...@gmail.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Sometimes all my menus are disabled

2017-02-13 Thread Steve Mills

On Feb 13, 2017, at 08:50 AM, Steve Mills  wrote:

On Feb 13, 2017, at 08:12:59, Andreas Falkenhahn  wrote:

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

Same problem here. I added this:

-(BOOL)validateMenuItem:(NSMenuItem *)menuItem
{
       NSLog(@"%@", menuItem.title);
     return YES;
}

to help see what's going on. When it works, it logs About, Prefs, and Plugins. 
When it fails, it only logs About and Prefs. Gotta get to the office now, or 
I'd investigate further.

I've dinked around with it a bit more and ended up replacing MainMenu.nib with 
a new MainMenu.xib. That fixes it. I'm on an older Xcode now, so I can't open 
your MainMenu.nib, so I opened its designable.nib with a text editor to see if 
there's anything obvious. One thing that's really weird is that all the menus 
for the menubar are also duplicated as submenu items of the first separator 
after the About item. Although it's not an exact copy, since Plugins doesn't 
appear in that version of the app menu.

So yeah, make a new xib and throw the old one out.

Sent from iCloud's ridiculous UI, so, sorry about the formatting

 
 
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Sometimes all my menus are disabled

2017-02-13 Thread Steve Mills
On Feb 13, 2017, at 08:12:59, Andreas Falkenhahn  wrote:
> 
> 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

Same problem here. I added this:

-(BOOL)validateMenuItem:(NSMenuItem *)menuItem
{
NSLog(@"%@", menuItem.title);
return YES;
}

to help see what's going on. When it works, it logs About, Prefs, and Plugins. 
When it fails, it only logs About and Prefs. Gotta get to the office now, or 
I'd investigate further.

BTW, when you use ellipses in menu item titles, use the real ellipses 
character, option-semicolon.

--
Steve Mills
Drummer, Mac geek


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Sometimes all my menus are disabled

2017-02-13 Thread Andreas Falkenhahn
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 

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 Falkenhahnmailto:andr...@falkenhahn.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com