• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Segfault when releasing autorelease pool
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Segfault when releasing autorelease pool


  • Subject: Segfault when releasing autorelease pool
  • From: Sean McGroty <email@hidden>
  • Date: Sun, 30 Oct 2005 22:28:32 -0500

I'm working on a framework and am encountering a frustrating problem.
When I attempt to free the autorelease pool, the program crashes with a segmentation fault.
It has to be related to the initWithSerialDeviceFileName code, as allocating and initializing the base class of GDFreestyleMeter, GDMeter, works properly. Specifically, the problem appears to center on the "meterDevice = [NSFileHandle fileHandleForUpdatingAtPath:deviceFile];" line in initWithSerialDeviceFileName, as commenting that out allows the program to quit successfully, at the cost of not doing anything useful.
What am I doing wrong?


My main.m file:

#import <Foundation/Foundation.h>
#import "GDFreestyleMeter.h"

int main(int argc, const char * argv[])
{
    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];

GDFreestyleMeter* testMe = [[GDFreestyleMeter alloc] initWithSerialDeviceFileName:[NSString stringWithUTF8String:argv[1]]];

    [testMe release];

    [pool release];
    return 0;
}


The initWithSerialDeviceFileName code:

- (id)initWithSerialDeviceFileName:(NSString*)deviceFile
{
if(self = [super init])
{
meterDevice = [NSFileHandle fileHandleForUpdatingAtPath:deviceFile];
if(meterDevice == nil)
{
NSException* noFile = [NSException exceptionWithName:@"SerialPortDoesNotExistException" reason:@"The serial port specified does not exist" userInfo:[NSDictionary dictionaryWithObject:deviceFile forKey:@"devicePath"]];
[noFile raise];
}
[self setSerialPortOptions];
}
return self;
}
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden
  • Follow-Ups:
    • Re: Segfault when releasing autorelease pool
      • From: j o a r <email@hidden>
    • Re: Segfault when releasing autorelease pool
      • From: Cameron Hayne <email@hidden>
  • Prev by Date: RePost (sort of) for Nick Zitzmann
  • Next by Date: Re: Segfault when releasing autorelease pool
  • Previous by thread: Re: RePost (sort of) for Nick Zitzmann
  • Next by thread: Re: Segfault when releasing autorelease pool
  • Index(es):
    • Date
    • Thread