• 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: [help!] a strange crash (to me) [SOLVED, i think]...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [help!] a strange crash (to me) [SOLVED, i think]...


  • Subject: Re: [help!] a strange crash (to me) [SOLVED, i think]...
  • From: Steve Christensen <email@hidden>
  • Date: Wed, 14 Jan 2004 17:07:25 -0800

I got some help off-list, but the basic problem seemed to be what libraries my app was linking against. I'd started with CW's Cocoa application stationery, tossed out the "Hello World" stuff, then added in all my stuff. It was linking to, among other things, the CoreServices framework. I replaced that with the CoreFoundation framework (probably obvious in retrospect, given that it was crashing in CFURLCreateFromFSRef), and it runs just peachy using ObjectAlloc.

This leaves me with three questions:

1. Should I also link against the CoreServices framework, even though it seems to be running fine as-is?

2. Is it me, or does anyone else find it annoying that Unix-style linkers let you link against whatever you like, but you don't find out that you got the right ones until you run your app and it goes boom!?

3. One of the off-list questions I got was finding it suspicious that my app was linked against /usr/lib/libobjc.A.dylib, even though that was one of the default frameworks in CW's stationery. Is that a library I -should- be linking against?

Thanks for all the help and feedback, folks!

steve


On Jan 14, 2004, at 12:34 AM, p3consulting wrote:

FYI

under 10.3.2 and using objectAlloc with your example code and calling:

NSString *aString = [NSString findFolderInDomain:kUserDomain type:kTrashFolderType create:NO] ;
NSLog(@"%@",aString);

doesn't crash here.

What arguments (domain, folderType, create) are you passing when you get the crash ?
Do you get the same crash for every set of arguments ?

Pascal Pochet
P3 Consulting

On 13 janv. 2004, at 20:07, Steve Christensen wrote:

I wrote an addition to NSString to return the full path to one of the special system directories, using FindFolder. I went this route instead of using NSSearchPathForDirectoriesInDomains since I have access to more directory choices. Anyway, my code is based off a snippet in listing 9-2 at http://developer.apple.com/documentation/Cocoa/Conceptual/ LowLevelFileMgmt/Tasks/LocatingDirectories.html:

+ (NSString*) findFolderInDomain:(short)domain type:(OSType)folderType create:(BOOL)create
{
NSString* path = nil;
FSRef folderRef;

if (FSFindFolder(domain, folderType, create, &folderRef) == noErr)
{
CFURLRef url = CFURLCreateFromFSRef(kCFAllocatorDefault, &folderRef);

if (url != nil)
{
path = (NSString*) CFURLCopyFileSystemPath(url, kCFURLPOSIXPathStyle);

CFRelease(url);
}
}

return path;
}

The problem I'm running into is that the call to CFURLCreateFromFSRef crashes in two cases: my client's computer running 10.2.x and on my 10.3.2 machine running the developer application ObjectAlloc. I've been running it on my machine, both in CW's debugger and standalone with no problems, so this came as a bit of a surprise.

Exception: EXC_BAD_ACCESS (0x0001)
Codes: KERN_INVALID_ADDRESS (0x0001) at 0xff9cc000

Thread 0 Crashed:
0 0x00003a8c _start + 0x100
1 0x0000b4cc +[NSString(FindFolderExtensions) findFolderInDomain:type:create:] + 0x6c


Any clues as to what might be causing this and/or what else I might look at to try to narrow this down?

Thanks mucho...

steve
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >[help!] a strange crash (to me)... (From: Steve Christensen <email@hidden>)
 >Re: [help!] a strange crash (to me)... (From: p3consulting <email@hidden>)

  • Prev by Date: Re: Horizontal scrollbar is not activated in TableView
  • Next by Date: Re: HTTP POST
  • Previous by thread: Re: [help!] a strange crash (to me)...
  • Next by thread: Setting a documents file type during save as=8 5
  • Index(es):
    • Date
    • Thread