bug-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Segfault when NSTextView is released


From: Sebastian Reitenbach
Subject: Re: Segfault when NSTextView is released
Date: Fri, 14 Feb 2014 18:46:29 +0100
User-agent: SOGoMail 2.1.1b

Hi,

I had a problem with GNUMail, crashing often on me. You wrote in your initial
mail that you use latest releases. Is that true for libobjc2 too?
The problem I had seen on GNUMail was gone for me after upgrading
libobjc2 to latest SVN.
The backtrace I got looked a bit different, and your problem might be
something completely different ;)

cheers,
Sebastian



On Friday, February 14, 2014 17:36 CET, Fred Kiefer <fredkiefer@gmx.de> wrote: 
 
> Looks like this is rather a question for David. It is more about the
> semantic of ARC for different sorts of ivars, than about NSTextView itself.
> In the code you did send the tvIvar ivar was not defined as a property.
> In this case I would expect that the compiler wont do anything special.
> 
> To get me to long into a potential NSTextView issue you will have to
> provide an ARC free example that crashes :-(
> I am still using gcc for GNUstep development. So I tried to rewrite your
> code to the old gcc supported form of properties and it did not crash in
> that form.
> 
> Automatic reference counting is great, but you really need to know what
> you are doing.
> 
> Fred
> 
> 
> On 13.02.2014 11:41, Lundberg, Johannes wrote:
> > I solved the problem temporary by changing properties for NSTextView from
> > strong to assign.
> > 
> > 
> > --
> > Johannes Lundberg
> > BRILLIANTSERVICE CO., LTD.
> > 
> > 
> > On Thu, Feb 13, 2014 at 7:14 PM, Lundberg, Johannes <
> > johannes@brilliantservice.co.jp> wrote:
> > 
> >> Thanks Fred.
> >>
> >> I put together a small program for you.
> >>
> >> The problem seems to be when the text view is assigned to an ivar.
> >> Removing from superview and setting ivar = nil maybe over releases it or
> >> something?
> >>
> >>
> >>
> >>
> >> --
> >> Johannes Lundberg
> >> BRILLIANTSERVICE CO., LTD.
> >>
> >>
> >> On Thu, Feb 13, 2014 at 5:50 PM, Fred Kiefer <fredkiefer@gmx.de> wrote:
> >>
> >>> I hope to be able to look into this tomorrow. It would help if you could
> >>> send a piece of example code showing the issue.
> >>>
> >>> Fred
> >>>
> >>> On the road
> >>>
> >>> Am 13.02.2014 um 09:16 schrieb "Lundberg, Johannes" <
> >>> johannes@brilliantservice.co.jp>:
> >>>
> >>> Nope I was wrong..
> >>> Using the designated initializer (with textContainer nil or set to
> >>> created text container object) fixes the release bug but whenever I try to
> >>> change a property I get crash. Stuck between rock and hard place...
> >>>
> >>> #0  0x0000000800d9e191 in -[NSTextView setTextColor:] (self=<value
> >>> optimized out>, _cmd=<value optimized out>, color=<value optimized out>) 
> >>> at
> >>> NSTextView.m:2407
> >>> #1  0x000000000041d74f in -[PhotoViewController loadView]
> >>> (self=0x81df558d0, _cmd=0x8011e7770) at PhotoViewController.m:81
> >>> #2  0x0000000800dc5122 in -[NSViewController view] (self=0x81df558d0,
> >>> _cmd=<value optimized out>) at NSViewController.m:94
> >>> #3  0x000000000042b255 in -[AppDelegate applicationDidFinishLaunching:]
> >>> (self=0x81b091510, _cmd=0x8010fe2a0, notification=0x81d1f1c50) at
> >>> AppDelegate.m:171
> >>> #4  0x00000008015dec4c in -[NSNotificationCenter _postAndRelease:]
> >>> (self=0x81b2b96b0, _cmd=<value optimized out>, notification=0x81d1f1c50) 
> >>> at
> >>> NSNotificationCenter.m:1191
> >>> #5  0x0000000800c9884e in -[NSApplication _didFinishLaunching]
> >>> (self=0x81b0a9490, _cmd=<value optimized out>) at NSApplication.m:1186
> >>> #6  0x0000000800c995ce in -[NSApplication run] (self=0x81b0a9490,
> >>> _cmd=<value optimized out>) at NSApplication.m:1539
> >>> #7  0x0000000000426935 in main (argc=2, argv=0x7fffffffc798) at main.m:20
> >>>
> >>>
> >>>
> >>> --
> >>> Johannes Lundberg
> >>> BRILLIANTSERVICE CO., LTD.
> >>>
> >>>
> >>> On Thu, Feb 13, 2014 at 3:14 PM, Lundberg, Johannes <
> >>> johannes@brilliantservice.co.jp> wrote:
> >>>
> >>>> Ok it seems like using the
> >>>>
> >>>> -(id) initWithFrame: (NSRect)frameRect
> >>>>       textContainer: (NSTextContainer *)container;
> >>>>
> >>>> initializer is the way to go. No segfault with this initializer.
> >>>>
> >>>> However as it says in the header:
> >>>> /* This variant will create the text network (NSTextStorage,
> >>>> NSLayoutManager,
> >>>> and a NSTextContainer). The network will be owned by the NSTextView;
> >>>> releasing it will release all parts of the network. */
> >>>> -(id) initWithFrame: (NSRect)frameRect;
> >>>>
> >>>> initWithFrame should work and not cause segfault so something seems to
> >>>> be wrong..
> >>>>
> >>>> (I know I wrote alloc] init] in the previous mail but I was actually
> >>>> using initWithFrame and it caused segfault for me)
> >>>>
> >>>>
> >>>> --
> >>>> Johannes Lundberg
> >>>> BRILLIANTSERVICE CO., LTD.
> >>>>
> >>>>
> >>>> On Thu, Feb 13, 2014 at 1:58 PM, Lundberg, Johannes <
> >>>> johannes@brilliantservice.co.jp> wrote:
> >>>>
> >>>>> Hi
> >>>>>
> >>>>> I'm using latest version of GNUstep on FreeBSD 10 64bit with ARC.
> >>>>> When my NSTextView is freed I get segfault. I haven't seen this
> >>>>> behavior for any other UI element.
> >>>>>
> >>>>> Example: Put this code in loadview
> >>>>>     NSTextView *tv = [[NSTextView alloc] init];
> >>>>>
> >>>>> and it segfaults when object is released.
> >>>>>
> >>>>> I haven't really done any debugging yet except finding where this
> >>>>> happens. Thought I send this mail first before I dive into the gui 
> >>>>> source
> >>>>> code.
> >>>>>
> >>>>> #0  0x0000000802d9aa74 in objc_msgSend_fpret () from
> >>>>> /usr/local/lib/libobjc.so.4.6
> >>>>> #1  0x0000000800db5379 in -[NSView dealloc] (self=0x81aee9b90,
> >>>>> _cmd=<value optimized out>) at NSView.m:651
> >>>>> #2  0x0000000800d9951a in -[NSTextView dealloc] (self=<value optimized
> >>>>> out>, _cmd=<value optimized out>) at NSTextView.m:1141
> >>>>> #3  0x0000000800d9121b in -[NSTextContainer dealloc] (self=0x81ddd1f30,
> >>>>> _cmd=0x8011e3b60) at NSTextContainer.m:134
> >>>>> #4  0x00000008014fe67a in -[GSArray dealloc] (self=0x81e411290,
> >>>>> _cmd=<value optimized out>) at GSArray.m:137
> >>>>> #5  0x0000000802d9b5c9 in objc_autoreleasePoolPop () from
> >>>>> /usr/local/lib/libobjc.so.4.6
> >>>>> #6  0x000000080154a400 in -[NSAutoreleasePool dealloc]
> >>>>> (self=0x81af462f0, _cmd=<value optimized out>) at 
> >>>>> NSAutoreleasePool.m:729
> >>>>> #7  0x0000000800c975d4 in -[NSApplication run] (self=0x81aca9490,
> >>>>> _cmd=0x8011e3b60) at NSApplication.m:1543
> >>>>> #8  0x0000000000425965 in main (argc=2, argv=0x7fffffffc798) at
> >>>>> main.m:20
> 
> 
> _______________________________________________
> Bug-gnustep mailing list
> Bug-gnustep@gnu.org
> https://lists.gnu.org/mailman/listinfo/bug-gnustep
 
 
 
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]