• 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
Re: has exited due to signal 10 (SIGBUS).
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: has exited due to signal 10 (SIGBUS).


  • Subject: Re: has exited due to signal 10 (SIGBUS).
  • From: Nick Zitzmann <email@hidden>
  • Date: Thu, 16 Dec 2004 22:49:32 -0700


On Dec 16, 2004, at 10:20 PM, Amit Kumar(R&D) wrote:

Ok, I am sending the snippet of my code.

You've made a number of mistakes in your code. I'll point out the errors and give out some advice:


int pc = [profile count];

NSArray's -count method returns an unsigned int, not an int.

	QpmPublicationController *opc =[QpmPublicationController alloc];

	for(val=0 ; val < pc ; val++) //profile contains the product ID
	{
		QpmPublicationProduct *abc = [QpmPublicationProduct alloc];

First of all, a call to +alloc alone is useless; you also have to initialize the object. But in the case of the "abc" object, I don't think you want to do this in the first place, since you're overwriting the pointer below:


abc = [opc getPublicationProductInfo: thePID];

Here you're overwriting the pointer to the QpmPublicationProduct object you allocated but did not initialize above. Because this leaks memory, you shouldn't have allocated the first object.


		[pProductDict setObject: abc forKey:[NSNumber numberWithInt:
thePID]];

You established above that thePID is an unsigned long; you shouldn't treat it as if it was a signed int.


[abc release];

You shouldn't release any object you did not obtain from +new, -init, or -copy. Because the object was obtained from -getPublicationProductInfo: above, it should be in the autorelease pool, and so your -release statement could cause a crash later on.


NSString *fpath = @"../PublicationProducts/";

Your application should not depend on relative paths, because the PWD could be anything. When you run the app in Xcode, it may be the application's directory, but as of right now when you run an app in the Finder, the Finder sets the PWD to the root (/).


	fpath = [fpath stringByAppendingString: [[NSNumber numberWithInt:
thePPID] stringValue]];
	fpath = [fpath stringByAppendingString:@".xml"];

You could combine all of that into one string, like this:

NSString *fpath = [NSString stringWithFormat:@"%@/PublicationProducts/%lu.xml", someAbsolutePath, thePPID];

...where "someAbsolutePath" is an NSString containing the absolute path leading up to the PublicationProducts folder.

	QpmXMLParsingHelper* aHelper = [QpmXMLParsingHelper alloc]  ;
	QpmPublicationProduct* aPP = [QpmPublicationProduct alloc] ;

Once again, you need to initialize these objects.

I hope this helps!

Nick Zitzmann
<http://www.chronosnet.com/>

_______________________________________________
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: has exited due to signal 10 (SIGBUS).
      • From: "Sean McBride" <email@hidden>
References: 
 >RE: has exited due to signal 10 (SIGBUS). (From: "Amit Kumar(R&D)" <email@hidden>)

  • Prev by Date: RE: has exited due to signal 10 (SIGBUS).
  • Next by Date: Re: has exited due to signal 10 (SIGBUS).
  • Previous by thread: RE: has exited due to signal 10 (SIGBUS).
  • Next by thread: Re: has exited due to signal 10 (SIGBUS).
  • Index(es):
    • Date
    • Thread