I use GNUstep 0.6.5 (gsetp-core-000405)

I have the following contruction in my program (listed at end of this mail).
When Timer fire is reached, than method timeCheck is called and
executed of [scheduler invalidate] and [scheduler release] is wrong.
In Openstep for Mach 4.2 this construction works good.
I got message in debuger:

Apr 07 14:20:38 LetvisGNU[3985] NSTimer.m:151  Assertion failed in NSTimer, method invalidate.  NSInternalInconsistencyException
Uncaught exception NSInternalInconsistencyException, reason: NSTimer.m:151  Assertion failed in NSTimer, method invalidate.  NSInternalInconsistencyException

Program received signal SIGABRT, Aborted.
0x4059b601 in kill ()
(gdb) bt
#0  0x4059b601 in kill ()
#1  0x4059b42f in gsignal ()
#2  0x4059c64f in abort ()
#3  0x4039fa80 in   () at NSException.m:42
#4  0x4039fdee in -[NSException raise] (self=0x875bd30, _cmd=0x40474584)
    at NSException.m:110
#5  0x4039fbd8 in +[NSException raise:format:arguments:] (self=0x40474504,
    _cmd=0x4046996c, name=0x4048c298, format=0x8761d98, argList=0xbffff3b8)
    at NSException.m:75
#6  0x4037439d in -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] (self=0x85e2b80, _cmd=0x4048743c, aSelector=0x404873fc,
    object=0x8919e88, fileName=0x8763c58, line=151, format=0x4048c298)
    at NSAssertionHandler.m:89
#7  0x40400ed9 in -[NSTimer invalidate] (self=0x8919e88, _cmd=0x404873fc)
    at NSTimer.m:151
#8  0x40400ce9 in -[NSTimer fire] (self=0x8919e88, _cmd=0x404827ac)
    at NSTimer.m:127
#9  0x403ea5c6 in -[NSRunLoop limitDateForMode:] (self=0x82c2860,
    _cmd=0x404828e4, mode=0x404829e4) at NSRunLoop.m:792
#10 0x403eb7a8 in -[NSRunLoop runMode:beforeDate:] (self=0x82c2860,
    _cmd=0x4020608c, mode=0x404829e4, date=0x82c3d00) at NSRunLoop.m:1280
#11 0x400daa35 in -[NSGraphicsContext(Ops) DPSGetEventMatchingMask:beforeDate:inMode:dequeue:] (self=0x82ae528, _cmd=0x402b22a0, mask=4294967295,
    limit=0x82c3d00, mode=0x404829e4, flag=1 '\001')
    at NSGraphicsContext.m:2151
#12 0x4027fab0 in -[XGContext(X11Ops) DPSGetEventMatchingMask:beforeDate:inMode:dequeue:] (self=0x82ae528, _cmd=0x401ebcfc, mask=4294967295, limit=0x82c3d00,
    mode=0x404829e4, flag=1 '\001') at SharedX/XGContextEvent.m:1771
#13 0x40093495 in -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] (self=0x830e880, _cmd=0x401ec3ec, mask=4294967295, expiration=0x82c3d00,
    mode=0x404829e4, flag=1) at ../Headers/AppKit/DPSOperators.h:2520
#14 0x40092344 in -[NSApplication run] (self=0x830e880, _cmd=0x81c4f28)
    at NSApplication.m:862
#15 0x80677df in main (argc=1, argv=0xbffff774) at LetvisGNU_main.m:13
 
 
 

@interface MyObj: NSObject
{
    NSTimer *scheduler;
}
- (void) timeCheck: (NSTimer *) aTimerl;
@end

@implementation MyObj

- init
{
    [super init];
    scheduler = [NSTimer scheduledTimerWithTimeInterval: 3.0
                                            target: self
                                          selector: @selector(timeCheck:)
                                          userInfo: nil
                                           repeats: NO];
        [scheduler retain];
    ....
    return self;
}

- (void) timeCheck: (NSTimer *) aTimerl
{
    [scheduler invalidate];
    [scheduler release];
    scheduler = nil;

    // Do something
}
@end

Jan Trembulak
[EMAIL PROTECTED]

Reply via email to