• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Odd Crash when adding table columns manually
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Odd Crash when adding table columns manually


  • Subject: Re: Odd Crash when adding table columns manually
  • From: Eric Gorr <email@hidden>
  • Date: Wed, 12 Jan 2011 10:08:22 -0500

Try grabbing the project again - I have cleaned up a few things which should make this a bit easier.

http://ericgorr.net/cocoadev/TableColumnTest.zip

It should crash everytime as long as in TableController.m the column are not being removed from the table first. You will have to go in an comment out that  line of code yourself.

I have also uploaded two screen recordings showing the crash.

http://ericgorr.net/cocoadev/TableColumnTestCrash01.m4v
http://ericgorr.net/cocoadev/TableColumnTestCrash02.m4v

The first movie is just using xcode & the debugger.
The second movie is running with zombies.



On Jan 12, 2011, at 9:52 AM, Keary Suska wrote:

> On Jan 11, 2011, at 5:49 PM, Eric Gorr wrote:
>
>> I do release them after adding them to the table. It will still crash...
>
> I cannot reproduce the crash with your test project. Have you verified, using zombies, that in fact it is a table column crashing? It might have to do with an invalid data source object...
>
>> On Jan 11, 2011, at 7:29 PM, Peter Lübke <email@hidden> wrote:
>>
>>> Table columns are retained by the table view they are added to.
>>>
>>> So you can safely release or autorelease the table column right after invoking -addTableColumn: .
>>> The table view owns its columns and will release them when it itself is released.
>>>
>>> This is the normal behaviour when adding subviews to an NSView or its subclasses.
>>>
>>> Peter
>>>
>>>
>>> Am 11.01.2011 um 18:06 schrieb Eric Gorr:
>>>
>>>> I've got a sample test project at:
>>>>
>>>> http://ericgorr.net/cocoadev/TableColumnTest.zip
>>>>
>>>> which reproduces the strange crash.
>>>>
>>>> I have a NSTableView to which I need to add NSTableColumns manually using the addTableColumn: method. The problem is that for some reason when I release the window and everything is being deallocated, someone has an extra retain on the table column and it sticks around. This causes a crash because the OS tries to redraw the table which really isn't there.
>>>>
>>>> Note: With the code as written, it will only cause a crash sometimes...if you comment back in the call to the EventAvail function in WindowTestAppDelegate.m, it will crash every time...this is how I ended up finding the odd behavior to begin with - I am working with a cocoa/carbon app and EventAvail is still being called.
>>>>
>>>> I can avoid the crash if, in my TableController class, I manually remove the table column from the table first. Is this what I am expected to do if I manually add the column? I would not have thought so, but perhaps I am wrong...?
>>>>
>>>> In TableController.m, I have the function GetNewColumn which creates a new table column. After I alloc and init the column, I can log the retain count of the column and see that it is 1. After I call setWidth: on the table column, I can see that the retain count is 2.
>>>>
>>>> Can anyone shed some light on what might be going on here and why it is crashing?
>>>>
>>>> (if it matters, I am still running on 10.6.5)
>
> Keary Suska
> Esoteritech, Inc.
> "Demystifying technology for your home or business"
>

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Odd Crash when adding table columns manually
      • From: Eric Gorr <email@hidden>
References: 
 >Odd Crash when adding table columns manually (From: Eric Gorr <email@hidden>)
 >Re: Odd Crash when adding table columns manually (From: Peter Lübke <email@hidden>)
 >Re: Odd Crash when adding table columns manually (From: Eric Gorr <email@hidden>)
 >Re: Odd Crash when adding table columns manually (From: Keary Suska <email@hidden>)

  • Prev by Date: Re: Odd Crash when adding table columns manually
  • Next by Date: Re: sending a message from an initializer method
  • Previous by thread: Re: Odd Crash when adding table columns manually
  • Next by thread: Re: Odd Crash when adding table columns manually
  • Index(es):
    • Date
    • Thread