It’s worth noting that ARC is no panacea.  It will not magically solve all
of the problems we have with memory management.

On Mon, Feb 7, 2022 at 09:14 Sergei Golovin <oozea...@yahoo.com> wrote:

> On 2022-02-06 22:50:07 +0400 Fred Kiefer <fredkie...@gmx.de> wrote:
>
> > Your change looks great to me, as always. Let's just hope it does not
> > break
> > anything for the other two issues that caused the different changes
> > on that
> > code.
>
> 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?
>
> The attached patch changes the -[dealloc] to do the code chunk
> equivalent to -[setMenu:nil]
> avoiding that -[NSPopUpButtonCell synchronizeTitleAndSelectedItem] and
> following.
>
> --
> SG
>
>   <gtam_segfault_on_quit_bug.patch>
>
-- 
Gregory Casamento
GNUstep Lead Developer / OLC, Principal Consultant
http://www.gnustep.org - http://heronsperch.blogspot.com
https://www.patreon.com/bePatron?u=352392 - Become a Patron
https://gf.me/u/x8m3sx - My GNUstep GoFundMe
https://teespring.com/stores/gnustep - Store

Reply via email to