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

Do not call -[setMenu: nil] from -[dealloc] #137

Closed
wants to merge 14 commits into from

Conversation

svgol
Copy link
Contributor

@svgol svgol commented Feb 8, 2022

https://savannah.gnu.org/bugs/?61727

That one issue in December was due to deallocation of NSPopUpButtonCell
causing to call -[synchronizeTitleAndSelectedItem] followed with updating
of the _menuItem, its _menu and all dependants (validators) where
the segfault occurs because one of the validators has been deallocated already.

#0 0x00007ffff6ee9415 in objc_msg_lookup () from /usr/lib/x86_64-linux-gnu/libobjc.so.4
#1 0x00007ffff7845af0 in -[NSApplication targetForAction:to:from:] (self=0x5555559683a0, _cmd=0x7ffff7c72330 <_OBJC_SELECTOR_TABLE+2384>,
theAction=0x555555ad8570, theTarget=0x555555e464b0, sender=0x555555d1feb0) at NSApplication.m:2294
#2 0x00007ffff7949ca8 in -[NSMenu _autoenableItem:] (self=0x555555d1fa40, _cmd=0x7ffff7c723f0 <_OBJC_SELECTOR_TABLE+2576>,
item=0x555555d1feb0) at NSMenu.m:1184
#3 0x00007ffff794a078 in -[NSMenu update] (self=0x555555d1fa40, _cmd=0x7ffff7c721a0 <_OBJC_SELECTOR_TABLE+1984>) at NSMenu.m:1260
#4 0x00007ffff7948f56 in -[NSMenu itemChanged:] (self=0x555555d1fa40, _cmd=0x7ffff7c79650 <_OBJC_SELECTOR_TABLE+496>,
anObject=0x555555d1fdd0) at NSMenu.m:878
#5 0x00007ffff7957bdd in -[NSMenuItem setImage:] (self=0x555555d1fdd0, _cmd=0x7ffff7c98cf0 <_OBJC_SELECTOR_TABLE+1168>, image=0x0)
at NSMenuItem.m:375
#6 0x00007ffff797c589 in -[NSPopUpButtonCell setMenuItem:] (self=0x555555d1fc60, _cmd=0x7ffff7c98da0 <_OBJC_SELECTOR_TABLE+1344>, item=0x0)
at NSPopUpButtonCell.m:652
#7 0x00007ffff797cf77 in -[NSPopUpButtonCell synchronizeTitleAndSelectedItem] (self=0x555555d1fc60,
_cmd=0x7ffff7c98ac0 <_OBJC_SELECTOR_TABLE+608>) at NSPopUpButtonCell.m:854
#8 0x00007ffff797b631 in -[NSPopUpButtonCell setMenu:] (self=0x555555d1fc60, _cmd=0x7ffff7c98940 <_OBJC_SELECTOR_TABLE+224>, menu=0x0)
at NSPopUpButtonCell.m:218
#9 0x00007ffff797b284 in -[NSPopUpButtonCell dealloc] (self=0x555555d1fc60, _cmd=0x7ffff7534970 <_OBJC_SELECTOR_TABLE+48>)
at NSPopUpButtonCell.m:153

May be doing that is excessive in the context of deallocation?

@rmottola
Copy link
Member

I am testing this a bit. I only have vague memories about the bug that led to the original commit you are essentially reverting. but it was very hard to reproduce, but in case consistent. I think it had to do with popupmenus with certain themes or so.

You do add
[_menu _setOwnedByPopUp: nil];
which might mitigate the original issue.

Also, the bug on savannah reports by Yavor a "works for me" comment on Fred's work... so is a fix still needed?

@svgol
Copy link
Contributor Author

svgol commented Mar 11, 2023

The issue is gone

@svgol svgol closed this Mar 11, 2023
@rmottola
Copy link
Member

Excellent, thanks for the check, because I was trying to do some tests and failed to reproduce.

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

Successfully merging this pull request may close these issues.

None yet

2 participants