discuss-gnustep
[Top][All Lists]
Advanced

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

Re: Mysterious crash in NSRunLoop, using libobjc2 on Linux


From: Lobron, David
Subject: Re: Mysterious crash in NSRunLoop, using libobjc2 on Linux
Date: Tue, 19 Dec 2017 18:57:30 +0000

Hey David-

I've now got a very pruned-down program that reproduces the bug.  However, that 
program still uses NSException, NSAutoreleasePool, and the 
NS_DURING/HANDLER/ENDHANDLER macros.  I've tried replacing these with plain 
@try/@catch and @throw in order to depend only on libobjc2, but so far the 
latter code hasn't reproduced the bug.  For example, here is some code from my 
minimal code that reproduces the bug:

@interface MinRep2 : NSObject {
}
- (void)poke;
@end
@implementation MinRep2
- (void)poke {
  NSAutoreleasePool *pool = [NSAutoreleasePool new];
  NS_DURING {
    [NSException raise:@"foo" format:@"bar"];
  } NS_HANDLER {
    [localException retain];
    [pool release];
    [[localException autorelease] raise];
  } NS_ENDHANDLER
      [pool release];
}
@end

I tried to translate this into code that depends only on libobjc2 as follows 
(this inherits the Test class in the libobjc2 Test directory):

@interface MinRep2 : Test {
}
- (void)poke;
@end
@implementation MinRep2
- (void)poke {
  id e1;
  @try {
    @throw e1;
  } @catch (id x) {
    [x retain];
    [x autorelease];
    @throw x;
  }
}
@end

Am I doing this translation approximately the right way?  The "raise" method in 
the gnustep-base NSException class does a lot of things, and so it's likely 
that my call to @throw above might be missing something essential to coercing 
the ObjC exceptions to and from a C++ one.

Thank you,

David




reply via email to

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