discuss-gnustep
[Top][All Lists]
Advanced

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

Re: another exception triggered by OGo in gnustep-base


From: Fred Kiefer
Subject: Re: another exception triggered by OGo in gnustep-base
Date: Fri, 29 Jul 2011 23:32:25 +0200
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; de; rv:1.9.2.18) Gecko/20110616 SUSE/3.1.11 Thunderbird/3.1.11

On 29.07.2011 19:25, Sebastian Reitenbach wrote:

On Friday, July 29, 2011 15:26 CEST, "Sebastian
Reitenbach"<address@hidden>  wrote:


On Friday, July 29, 2011 15:00 CEST, David
Chisnall<address@hidden>  wrote:

On 29 Jul 2011, at 13:51, Sebastian Reitenbach wrote:

I found this documentation here:
http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSData_Class/Reference/Reference.html

Initializes a newly allocated data object by adding to it length >>>>
bytes of data from the buffer bytes.

but it doesn't state that a subclass should implement it???

SkyDecodeWrapperData is a subclass of NSData, so I should
implement that method there?

I think this is a GNUstep bug.  The default implementation o
initWithBytesNoCopy:length:freeWhenDone: should probably be
releasing self and returning a new instance of the class that
does support this initialiser (as happens in the placeholder data
class).


While fiddling around there, I found that NSDataMalloc implements
initWithBytesNoCopy:length:freeWhenDone:, and I looked at it how it
is done there, and implemented it similarly in OGos
SkyDecodeWrapperData, which now works like a charm ;)

I think both OGo and libFoundation where wrong here. The method -initWithBytesNoCopy:length:freeWhenDone: is the designated initializer of the class NSData, although this isn't stated in the Apple documentation, but the initializer with the most arguments takes over this role and all other initializers should call this method.

libFoundation tried to implement that method with other initializers, which is just wrong. And OGO forgot to implement that method in their own subclass. Anyway, from your back trace it looks like the class [SkyDecodeWrapperData -initWithData:encoding:] calls [NSData -init], perhaps as a super call, this also looks wrong to me. although it normally wont do much harm.



reply via email to

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