On 15 Jun 2012, at 14:24, David Chisnall wrote:

> Hi Thomas,
> 
> A couple of questions:
> 
> Are you using the release version of libobjc or svn?  Your line numbers don't 
> match up with mine, so it may be that this is a bug that's already fixed in 
> svn.  I'm currently waiting for Quentin to test another bug fix and then I'll 
> be doing a new release next week.

Hi David,
I was at version 1.6, I have just pulled trunk, and tried again, I'm hitting 
the same thing, but now reporting line 561 of arc.m.

> 
> The second question is whether you remembered to initialise the weak pointer 
> to 0, or call objc_initWeak() for the first store?

The weak pointer is an ivar, so it should be 0 initialised, yes.  Just for 
completeness I've included my code below.

Thanks

Tom Davie

BBWeakRef.h
> #import <Foundation/Foundation.h>
> 
> @interface BBWeakRef : NSObject
> 
> + (id)refWithTarget:(id)target;
> - (id)initWithTarget:(id)target;
> 
> @property (weak) id target;
> 
> @end

BBWeakRef.m
> #import "BBWeakRef.h"
> 
> @implementation BBWeakRef
> 
> @synthesize target = _target;
> 
> + (id)refWithTarget:(id)target
> {
>     return [[BBWeakRef alloc] initWithTarget:target];
> }
> 
> - (id)initWithTarget:(id)target
> {
>     self = [super init];
> 
>     if (nil != self)
>     {
>         [self setTarget:target];
>     }
> 
>     return self;
> }
> 
> - (NSUInteger)hash
> {
>     return [[self target] hash];
> }
> 
> - (BOOL)isEqual:(id)other
> {
>     if ([other isKindOfClass:[BBWeakRef class]])
>     {
>         return [[(BBWeakRef *)other target] isEqual:[self target]];
>     }
>     return NO;
> }
> 
> @end

_______________________________________________
Discuss-gnustep mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/discuss-gnustep

Reply via email to