-
Notifications
You must be signed in to change notification settings - Fork 9
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
Remove GSFakeNSMenuItem class #7
Remove GSFakeNSMenuItem class #7
Conversation
This class doesn't appear to do anything but serve as a pass-through for the original object, so why not just use that?
@@ -151,7 +71,7 @@ void initialize_lock() | |||
} | |||
|
|||
// find all subitems for the given items... | |||
HMENU r_build_menu_for_itemmap(NSMenu *menu, BOOL asPopUp, BOOL fakeItem, NSMapTable *itemMap) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's a great idea to rename the variable fakeItem
to notPullDown
(or something similar) as this value is initially set to ![cell pullsDown]
in displayPopUpMenu
(line 554). But I'd suggest we update the name throughout, i.e. rename the fake
variable in displayPopUpMenu
and any other method that may use that name?
Left a comment, LGTM otherwise. @rfm @fredkiefer @gcasa - any thoughts? |
I am not familiar with this theme. If popup menus still work with your change, this sounds like a simplification that we should use. But @gcasa should decide. |
I agree with @fredkiefer. Please test pop up menus. If that works then the change is acceptable |
I am going to spin up a fresh windows install to test this. I need to do this anyway. I will report back once that is done. Thanks. |
@@ -271,11 +191,15 @@ HMENU r_build_menu_for_itemmap(NSMenu *menu, BOOL asPopUp, BOOL fakeItem, NSMapT | |||
{ | |||
flags = MF_STRING; | |||
s = menu_tag++; | |||
if(fakeItem) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gcasa @fredkiefer These lines were actually causing GSFakeMenuItems to replace NSMenuItems in memory leading to crashes when you clicked on a pop up.
item = [[GSFakeNSMenuItem alloc] initWithItem: item]; | ||
AUTORELEASE(item); | ||
} | ||
if (([item action] == NULL || [item target] == nil) && notPullDown && asPopUp) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gcasa @fredkiefer Once the GSFakeMenuItems were removed we were able to click on pop ups but they were inoperable because there was no action set on them. This change here populates the action.
@fredkiefer As @johnathan-becker mentioned, we are seeing crashes when invoking pop ups with the current implementation, and this PR fixes those crashes. So yes, we've tested this change. @gcasa Is there any additional testing you would like to perform? |
I haven't had a chance to test this with the latest msys2. If this works for you, then that's fine. I see no issue based on looking at the code, so go ahead and merge this change. |
According to Riccardo this change broke NSPopupButtons. It was either the pulldown or the popup version, I am not sure. In that case the displayed value won't be adjusted to the selected on. It would be great if you find a fix for that, or we will have to revert this change. |
@fredkiefer We're tracking a couple of issues with |
So, I spent some more time digging into this crash. I believe this is crash is caused by how message forwarding works when using libobjc2 on mingw-w64. If, in Not really sure what's going on here, but looks like there's either a bug in libobjc2 or in how libobjc2 and libs-base interact. |
This class doesn't appear to do anything but serve as a pass-through for the original object, so why not just use that?