Re: Crashes while reordering columns in a NSTableView

2009-07-22 Thread Rob Keniger


On 22/07/2009, at 2:42 AM, Nick Zitzmann wrote:

One thought: Are you using the -CGImage method of NSBitmapImageRep  
anywhere? If so, then you absolutely must not deallocate the  
NSBitmapImageRep while the CGImageRef is live, because the  
CGImageRef acquired via -CGImage is still using the  
NSBitmapImageRep's data.



Hm, that's interesting. I'm using Garbage Collection, so does this  
mean that I can't do this and get away with it?:


@implementation NSImage (Additions)
- (CGImageRef)CGImage;
{
	return [[[NSBitmapImageRep alloc] initWithData:[self  
TIFFRepresentation]] CGImage];

}
@end

Could explain a few things...

--
Rob Keniger



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Crashes while reordering columns in a NSTableView

2009-07-21 Thread Alexander Spohr


Am 21.07.2009 um 00:38 schrieb Tim Schmidt:


Is there any way to work around this


Yes: find your memory bug.
EXC_BAD_ACCESS almost always is a memory bug in your code.

atze

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Crashes while reordering columns in a NSTableView

2009-07-21 Thread Tim Schmidt


On Jul 20, 2009, at 11:18 PM, Alexander Spohr wrote:



Am 21.07.2009 um 00:38 schrieb Tim Schmidt:


Is there any way to work around this


Yes: find your memory bug.
EXC_BAD_ACCESS almost always is a memory bug in your code.

atze



Obviously CG's bitblock transfers access unallocated memory in this  
case. If I accidently free said memory it completely eludes me where  
this might happen (I am pretty confident I don't release any of my  
model/controller objects unintentionally (I tried running with all the  
usual mallocdebug options as well as NSZombies). Furthermore all NIBs  
are managed by NSViewController subclasses. Can anybody point me to  
some advanced guides on NSTableView (beyond the class reference and  
tables guide).

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Crashes while reordering columns in a NSTableView

2009-07-21 Thread Kyle Sluder
On Tue, Jul 21, 2009 at 9:32 AM, Tim Schmidtschmidt@gmx.net wrote:
 Obviously CG's bitblock transfers access unallocated memory in this case.

No, it probably doesn't.

Remember, 90% of the time, the bug is in your code.  The other 10% of
the time, the bug is in your code.

 If
 I accidently free said memory it completely eludes me where this might
 happen (I am pretty confident I don't release any of my model/controller
 objects unintentionally (I tried running with all the usual mallocdebug
 options as well as NSZombies).

Use Instruments.

 Furthermore all NIBs are managed by
 NSViewController subclasses. Can anybody point me to some advanced guides on
 NSTableView (beyond the class reference and tables guide).

There aren't any.  It's not a hard class to work with.

--Kyle Sluder
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Crashes while reordering columns in a NSTableView

2009-07-21 Thread I. Savant

On Jul 21, 2009, at 12:32 PM, Tim Schmidt wrote:

Obviously CG's bitblock transfers access unallocated memory in this  
case. If I accidently free said memory it completely eludes me where  
this might happen (I am pretty confident I don't release any of my  
model/controller objects unintentionally (I tried running with all  
the usual mallocdebug options as well as NSZombies). Furthermore all  
NIBs are managed by NSViewController subclasses. Can anybody point  
me to some advanced guides on NSTableView (beyond the class  
reference and tables guide).



  I'll assume you're not customizing the drag and drop process (or  
doing anything with the column drag delegate method).


  My own intuition tells me you might look into your cells. If you  
have any custom (header or data) cells for the column(s) involved or  
do any custom manipulation of those cells (such as  
with ...willDisplayCell:...) that'd be a place to start looking for  
memory management no-nos. Especially if it only happens with  
particular columns.


  Also, if you're using the table datasource protocol, it's possible  
your ...objectValue... datasource method is returning an improperly- 
managed instance of something or other.


  If you're doing anything custom, post your code.

--
I.S.


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Crashes while reordering columns in a NSTableView

2009-07-21 Thread Nick Zitzmann


On Jul 21, 2009, at 10:32 AM, Tim Schmidt wrote:

Obviously CG's bitblock transfers access unallocated memory in this  
case. If I accidently free said memory it completely eludes me where  
this might happen (I am pretty confident I don't release any of my  
model/controller objects unintentionally (I tried running with all  
the usual mallocdebug options as well as NSZombies). Furthermore all  
NIBs are managed by NSViewController subclasses. Can anybody point  
me to some advanced guides on NSTableView (beyond the class  
reference and tables guide).


One thought: Are you using the -CGImage method of NSBitmapImageRep  
anywhere? If so, then you absolutely must not deallocate the  
NSBitmapImageRep while the CGImageRef is live, because the CGImageRef  
acquired via -CGImage is still using the NSBitmapImageRep's data.


Nick Zitzmann
http://www.chronosnet.com/

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Crashes while reordering columns in a NSTableView

2009-07-21 Thread I. Savant
On Tuesday, July 21, 2009, Kyle Sluder kyle.slu...@gmail.com wrote:

 Remember, 90% of the time, the bug is in your code.  The other 10% of
 the time, the bug is in your code.

  That's just not true. Plenty of bugs in the frameworks. I've
personally logged dozens.  It's USUALLY your code but certainly not
always.


 There aren't any.  It's not a hard class to work with.

  Except when it is. Why so many absolutes? Try customizing table
views / columns / header views / etc. I mean beyond setting a custom
data cell or adding keyboard actions. Some of these mechanisms work in
unexpected (and sometimes conflicting) ways. Not all of This behavior
is documented either. It's not insurmountable but it's far from easy.
Tables are fairly complicated UI.

  If you have an app where a column is a first-class conceptual
model, for example, you might need a more interactive header cell ...
There be dragons.

  As to the OP's problem, however, I suspect the real issue is
probably pretty simple since he did not mention heavy customization.
Could be wrong though ...

--
I.S.
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Crashes while reordering columns in a NSTableView

2009-07-21 Thread Kyle Sluder
On Tue, Jul 21, 2009 at 9:56 AM, I. Savantidiotsavant2...@gmail.com wrote:
  That's just not true. Plenty of bugs in the frameworks. I've
 personally logged dozens.  It's USUALLY your code but certainly not
 always.

It's not intended to be an accurate statement.  The point is to avoid
jumping to conclusions.  Framework code is far more exposed than your
own, and it is immensely more likely that you've screwed up than the
Quartz devs have.

  If you have an app where a column is a first-class conceptual
 model, for example, you might need a more interactive header cell ...
 There be dragons.

You mean like OmniOutliner?  :)

  As to the OP's problem, however, I suspect the real issue is
 probably pretty simple since he did not mention heavy customization.
 Could be wrong though ...

This is where I was coming from.  Then I looked at the stack trace and
saw NSLayerKitGlue.  He might not be doing anything complicated, but
AppKit is.

--Kyle Sluder
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Crashes while reordering columns in a NSTableView

2009-07-21 Thread I. Savant

It's not intended to be an accurate statement.  The point is to avoid
jumping to conclusions.  Framework code is far more exposed than your
own, and it is immensely more likely that you've screwed up than the
Quartz devs have.



  I get that. I just don't think that's necessarily a good place to  
make that assertion. :-) My younger self spent hours on a bug I was  
sure was mine because it couldn't possibly be the API ... it was the  
API. :-)




 If you have an app where a column is a first-class conceptual
model, for example, you might need a more interactive header cell ...
There be dragons.


You mean like OmniOutliner?  :)


  I realize you work at Omni Group, so you see my point. :-) It's far  
from trivial to get this stuff heavily customized until you've spent a  
long time doing just that.


  Still - I own a copy of OmniOutliner registered to my real name - I  
see that the column headers (beyond a different drawing style) really  
only add right-click-to-show-context-menu action. That simple approach  
works perfectly for OmniOutliner, but I can think of more complicated  
scenarios where more direct interaction with the header itself would  
be the most natural approach ... *There* be dragons. :-D




This is where I was coming from.  Then I looked at the stack trace and
saw NSLayerKitGlue.  He might not be doing anything complicated, but
AppKit is.


  All I was saying there was that it's not really possible to assign  
a difficulty level as we don't really know what the OP is trying  
yet. :-)


  A note: Positively no disrespect intended.


--
I.S.


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com