Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Odd Menu Bar behaviour causes Anathema to break on OS X #332

Closed
UrsKR opened this issue Jun 7, 2013 · 15 comments
Closed

Odd Menu Bar behaviour causes Anathema to break on OS X #332

UrsKR opened this issue Jun 7, 2013 · 15 comments
Assignees
Labels

Comments

@UrsKR
Copy link
Member

UrsKR commented Jun 7, 2013

Reported by @curttasker in #330:

Odd Menu Bar Behavior

  1. Open the Equipment Database
  2. Keep your eyes on the menu bar for this next step
  3. Hover your mouse over one of the buttons below the stats row (add, edit, remove stats) until a tooltip appears.

You'll notice that the menu bar changed; All menus except a basic "Exit application" meny item have disappeared. cmd+q no longer works, and clicking the one menu bar item that still exists (the close cmd+q one) does not work. The only way to close the app is to click the X in the upper left corner of anathema's window.

While in this state, clicking around the app can cause this error to appear:

2013-06-06 14:37:10.523 java[37739:707] *** Assertion failure in -[NSMenuItem setSubmenu:], /SourceCache/AppKit/AppKit-1187.37/Menus.subproj/NSMenuItem.m:757
2013-06-06 14:37:10.523 java[37739:707] Menu to be set as submenu is already a submenu of some menu.
2013-06-06 14:37:10.525 java[37739:707] (
    0   CoreFoundation                      0x00007fff86fcab06 __exceptionPreprocess + 198
    1   libobjc.A.dylib                     0x00007fff898263f0 objc_exception_throw + 43
    2   CoreFoundation                      0x00007fff86fca948 +[NSException raise:format:arguments:] + 104
    3   Foundation                          0x00007fff8f537c82 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 189
    4   AppKit                              0x00007fff8bfd99a0 -[NSMenuItem setSubmenu:] + 200
    5   liblwawt.dylib                      0x000000016e3b1862 -[CMenuBar nativeAddMenuAtIndex_OnAppKitThread:] + 312
    6   liblwawt.dylib                      0x000000016e3b1f88 +[CMenuBar activate:modallyDisabled:] + 981
    7   liblwawt.dylib                      0x000000016e3a3975 -[AWTWindow windowDidBecomeKey:] + 141
    8   CoreFoundation                      0x00007fff86f7ceda _CFXNotificationPost + 2554
    9   Foundation                          0x00007fff8f573e26 -[NSNotificationCenter postNotificationName:object:userInfo:] + 64
    10  AppKit                              0x00007fff8c0eca76 -[NSWindow becomeKeyWindow] + 1344
    11  AppKit                              0x00007fff8c60214d _NXShowKeyAndMain + 127
    12  AppKit                              0x00007fff8c117f9f -[NSWindow sendEvent:] + 5414
    13  liblwawt.dylib                      0x000000016e3a1df0 -[AWTWindow_Normal sendEvent:] + 86
    14  AppKit                              0x00007fff8c114674 -[NSApplication sendEvent:] + 5761
    15  libosxapp.dylib                     0x000000016e0d8ad1 -[NSApplicationAWT sendEvent:] + 179
    16  AppKit                              0x00007fff8c02a24a -[NSApplication run] + 636
    17  libosxapp.dylib                     0x000000016e0d89b9 +[NSApplicationAWT runAWTLoopWithApp:] + 156
    18  liblwawt.dylib                      0x000000016e39381a -[AWTStarter starter:] + 1591
    19  Foundation                          0x00007fff8f5bdd3a __NSThreadPerformPerform + 225
    20  CoreFoundation               0x00007fff86f49b31 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
    21  CoreFoundation                      0x00007fff86f49455 __CFRunLoopDoSources0 + 245
    22  CoreFoundation                      0x00007fff86f6c7f5 __CFRunLoopRun + 789
    23  CoreFoundation                      0x00007fff86f6c0e2 CFRunLoopRunSpecific + 290
    24  java                                0x000000010c4c642d CreateExecutionEnvironment + 871
    25  java                                0x000000010c4c0bdc JLI_Launch + 1952
    26  java                                0x000000010c4c678a main + 101
    27  java                                0x000000010c4c0434 start + 52
    28  ???                                 0x0000000000000005 0x0 + 5
@UrsKR
Copy link
Member Author

UrsKR commented Jun 7, 2013

I rarely use the menu bar, so I didn't notice anything out of the ordinary despite noticing the error message. I thought it was another of those "will go away in J7u40" issues you mentioned earlier.

I shouldn't trust Java that much.

@curttasker
Copy link
Member

I rolled back to f1979a0, and the issue issue exists there as well; I just never noticed it due to the bigger issue with #330.

The issue happens with any of the "dark yellow" tooltips (the ones where the bottom right corner 'curls' as if its made of paper). These are seen only in parts of equipment manager, and they're different from light yellow non-curl tooltips seen everywhere else (I do mean everywhere, I checked them all).

I suspect that this is also a threading issue, like #330, that came about due to mixing and matching JavaFX and Swing.

This is possibly relevant, possibly not: http://stackoverflow.com/questions/16421556/mac-os-x-java-menu-bar-disappears . I found that after the issue occurs, if you multitask to another app using cmd+tab, tab back, most of the time the menubar has entirely disappeared. Instead, it shows the menubar for the application you just came from. Sometimes it pops back to the issue's broken menubar instead, but not often.

I'm still not sure if the error message listed in the main post is related; but it only happens after the issue occurs, so its likely. I dug up some an error message that looks similar: https://netbeans.org/bugzilla/show_bug.cgi?id=222684

@UrsKR
Copy link
Member Author

UrsKR commented Jun 7, 2013

The "curled page" tooltips are JavaFX tooltips, the "plain rectangle" ones are rendered by Swing.

@UrsKR
Copy link
Member Author

UrsKR commented Jun 7, 2013

I surmise that JavaFX tooltips are top level windows. Thus, OS X detects a new window and changes the menu bar to the "appropriate" one. Don't know why it breaks afterwards, though.

UrsKR added a commit that referenced this issue Jun 8, 2013
This is a workaround for #332. I am not sure if we can fix it properly without moving the entire system to JavaFX.
@UrsKR
Copy link
Member Author

UrsKR commented Jun 8, 2013

In efaec13, I have added a workaround that disables the tooltips if the application is running on a mac.
This fixes the issue for all existing tooltips, but obviously is a huge flaw for all future parts that introduce new ways to set a tooltip.

I have written another simple demo to test the general workings of the tooltips in FX on OS X, and it shows that this is an issue in the JavaFX/Swing interop or our usage of it. A pure FX application does not show the issue, tooltips and system-wide menubars interact flawlessly.

As such, one option would be to just sit the issue out. Another to find the root cause, but I don't have high hopes for that.

@UrsKR
Copy link
Member Author

UrsKR commented Jun 8, 2013

@curttasker, does the workaround fix the issue for you as well? If so, do you still object to finally releasing this one?

@curttasker
Copy link
Member

I'm fine with the workaround for the menubar.

That said, you're gonna kill me; I found another bug. The create item and delete item buttons in the equipment manager don't work on mac. I just found it, and don't have time to document it tonight, I'll start up a new issue tomorrow.

@UrsKR
Copy link
Member Author

UrsKR commented Jun 9, 2013

Actually, no, I'm loving you for it. I really appreciate your dedication and thoroughness.
I feel superficial every time you discover something that blocking and obvious. If I implicated something else in my question above, I'm sorry.

I have opened #335 and #336 for your discoveries, feel free to amend them as necessary.
Me and my MacBook have a train ride ahead of us and will try to get them fixed there.

Should we leave this one open and look for a permanent solution before the entire UI is converted in #334, or do you think this covers it for now?

@curttasker
Copy link
Member

I was just being sarcastic :)

#335 and #336 seem fixed, but there's still some screwy behavior going on.

Minor issue that got missed in the refactoring

  • Open Equipment Database
  • Click on an item in the left hand pane
  • Make a change to the item in the right hand pane.
  • Click on a different item in the left hand pane.

Expected: A Warning dialog box pops up stating "You have unsaved changes. Discard them?"
Actual: Changes are discarded automatically, right hand pane is changed to reflect the newly selected item

Same error as #332, different cause

  • Open Equipment Database
  • Click on an item in the left hand pane
  • Change the value of any drop list in the right hand pane
  • Click on Copy or New or Delete
  • Click cancel

Error produced

2013-06-09 14:59:49.224 java[52777:707] *** Assertion failure in -[NSMenuItem setSubmenu:], /SourceCache/AppKit/AppKit-1187.37/Menus.subproj/NSMenuItem.m:757
2013-06-09 14:59:49.224 java[52777:707] Menu to be set as submenu is already a submenu of some menu.
2013-06-09 14:59:49.226 java[52777:707] (
    0   CoreFoundation                      0x00007fff86fcab06 __exceptionPreprocess + 198
    1   libobjc.A.dylib                     0x00007fff898263f0 objc_exception_throw + 43
    2   CoreFoundation                      0x00007fff86fca948 +[NSException raise:format:arguments:] + 104
    3   Foundation                          0x00007fff8f537c82 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 189
    4   AppKit                              0x00007fff8bfd99a0 -[NSMenuItem setSubmenu:] + 200
    5   liblwawt.dylib                      0x000000016d4d0862 -[CMenuBar nativeAddMenuAtIndex_OnAppKitThread:] + 312
    6   liblwawt.dylib                      0x000000016d4d0f88 +[CMenuBar activate:modallyDisabled:] + 981
    7   liblwawt.dylib                      0x000000016d4c2975 -[AWTWindow windowDidBecomeKey:] + 141
    8   CoreFoundation                      0x00007fff86f7ceda _CFXNotificationPost + 2554
    9   Foundation                          0x00007fff8f573e26 -[NSNotificationCenter postNotificationName:object:userInfo:] + 64
    10  AppKit                              0x00007fff8c0eca76 -[NSWindow becomeKeyWindow] + 1344
    11  AppKit                              0x00007fff8c0ebf34 -[NSWindow _changeKeyAndMainLimitedOK:] + 719
    12  AppKit                              0x00007fff8c1ca34c -[NSWindow _orderOutAndCalcKeyWithCounter:stillVisible:docWindow:] + 909
    13  AppKit                              0x00007fff8c0f4179 -[NSWindow _reallyDoOrderWindow:relativeTo:findKey:forCounter:force:isModal:] + 3218
    14  AppKit                              0x00007fff8c0f3068 -[NSWindow _doOrderWindow:relativeTo:findKey:forCounter:force:isModal:] + 940
    15  AppKit                              0x00007fff8c0f2c4f -[NSWindow orderWindow:relativeTo:] + 159
    16  Foundation                          0x00007fff8f5bdd3a __NSThreadPerformPerform + 225
    17  CoreFoundation                      0x00007fff86f49b31 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
    18  CoreFounda                   0x00007fff86f49455 __CFRunLoopDoSources0 + 245
    19  CoreFoundation                      0x00007fff86f6c7f5 __CFRunLoopRun + 789
    20  CoreFoundation                      0x00007fff86f6c0e2 CFRunLoopRunSpecific + 290
    21  HIToolbox                           0x00007fff8e671eb4 RunCurrentEventLoopInMode + 209
    22  HIToolbox                           0x00007fff8e671c52 ReceiveNextEventCommon + 356
    23  HIToolbox                           0x00007fff8e671ae3 BlockUntilNextEventMatchingListInMode + 62
    24  AppKit                              0x00007fff8c033563 _DPSNextEvent + 685
    25  AppKit                              0x00007fff8c032e22 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 128
    26  libosxapp.dylib                     0x000000016d1f7b56 -[NSApplicationAWT nextEventMatchingMask:untilDate:inMode:dequeue:] + 124
    27  AppKit                              0x00007fff8c02a1d3 -[NSApplication run] + 517
    28  libosxapp.dylib                     0x000000016d1f79b9 +[NSApplicationAWT runAWTLoopWithApp:] + 156
    29  liblwawt.dylib                      0x000000016d4b281a -[AWTStarter starter:] + 1591
    30  Foundation                          0x00007fff8f5bdd3a __NSThreadPerformPerform + 225
    31  CoreFoundation                      0x00007fff86f49b31 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
    32  CoreFoundation                      0x00007fff86f49455 __CFRunLoopDoSources0 + 245
    33  CoreFoundation                      0x00007fff86f6c7f5 __CFRunLoopRun + 789
    34  CoreFoundation                      0x00007fff86f6c0e2 CFRunLoopRunSpecific + 290
    35  java                                0x000000010db6d42d CreateExecutionEnvironment + 871
    36  java                                0x000000010db67bdc JLI_Launch + 1952
    37  java                                0x000000010db6d78a main + 101
    38  java                                0x000000010db67434 start + 52
    39  ???                                 0x0000000000000005 0x0 + 5
)

This also causes the menubar to disappear as in #332

I'm going to be down in LA for E3 next week, and I'm hanging around for a two weeks to spend time with family; So I'm not going to have a whole lot of time to spend on this, but I'll at least be available for testing.

@UrsKR
Copy link
Member Author

UrsKR commented Jun 10, 2013

I know about the missing notification, it wasn't there before the refactoring either. I just didn't implement it yet.

About the other issue, I guess we're screwed.
The least intrusive approach I can think of is to replace the components with something that does not show popups for OS X only.

I'll have a look.

@curttasker
Copy link
Member

I ran the current build with 1.7.0_40:

  • Assertion failure is still present
  • Menubar still disappears.

Confirmed that everything is fine in windows under 1.7.0_21.

@UrsKR
Copy link
Member Author

UrsKR commented Jun 10, 2013

Thanks. I'll probably won't have much energy to fix this in the next few days, but I have an idea on how to fix it (thanks to a short conversation with @vestrial). It will mix up the UI on OS X, but I figure that's better than killing the app or not delivering this version on OS X.

@UrsKR
Copy link
Member Author

UrsKR commented Jun 10, 2013

Moved the minor issue to #337.

UrsKR added a commit that referenced this issue Jun 13, 2013
* Allows to remove listeners on IObjectSelectionViews
* Fixes some threading-issues
UrsKR added a commit that referenced this issue Jun 15, 2013
* Allows to remove listeners on IObjectSelectionViews
* Fixes some threading-issues
(cherry picked from commit c122ca9)
@UrsKR UrsKR closed this as completed in af0029d Jun 15, 2013
UrsKR added a commit that referenced this issue Jun 15, 2013
* Limits size of Lists that replace Comboboxes.
* Fixes #332. Again.
@UrsKR
Copy link
Member Author

UrsKR commented Jun 15, 2013

@curttasker, we now have an OS X-specific UI that no longer shows the issue.
It replaces all Comboboxes in FX with Lists - not ideal, not beautiful, but at least it's usable.

I'll start preparing the release and wait for a word from you before I press the button.

@curttasker
Copy link
Member

Sorry, been a little busy these past few days.

Lists instead of Comboboxes on OSX

The new Lists are serviceable for the most part, but there's a few little things that bothered me.

Selected Item Color #338 -- Fixed

Selected Item Visible #339 -- Fixed

Warning when discarding unsaved changes by selecting a different equipment item (#337)

#337 still isn't closed, but its not a critical issue. While it does work in 5.0.1, I'm fine with letting it stay as-is for the last 2.5E release. It just causes a minor to moderate inconvenience to players frequently making changes to items.

I did discover one additional issue, and I'm not sure if its a newly introduced one as a result of the osx changes done here, or if it was present before.

Edit button not becoming inactive #340

I'll work on the last one later tonight if I have time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants