(repost) CFDictionaryCreateMutableCopy crash
(repost) CFDictionaryCreateMutableCopy crash
- Subject: (repost) CFDictionaryCreateMutableCopy crash
- From: "\"Gábor Sebestyén\"" <email@hidden>
- Date: Thu, 23 Sep 2004 02:54:03 -0700
Hi,
I actually write a C++ wrapper class upon CFPreferences. In a value writer method the program crashes when it tries to create a mutable copy from a freshly retrieved dictionary.
The code is:
void Config::WriteInt(char* section, char* key, int value)
{
CFStringRef ksect = MY_CFSTRING(section); //section
CFStringRef kdict = MY_CFSTRING(key); //key in dict
CFNumberRef val = CFNumberCreate(NULL, kCFNumberIntType, &value);
CFDictionaryRef dict0 = CFPreferencesCopyAppValue(ksect, kCFPreferencesCurrentApplication);
CFMutableDictionaryRef dict;
if (dict0) {
CRASH HERE! =>
dict = CFDictionaryCreateMutableCopy(NULL, 0, dict0);
CFRelease(dict0);
} else {
dict = CFDictionaryCreateMutable(NULL, 1, NULL, NULL);
}
...
and the crash log:
Exception: EXC_BAD_ACCESS (0x0001)
Codes: KERN_INVALID_ADDRESS (0x0001) at 0x72617279
Thread 0 Crashed:
0 libobjc.A.dylib 0x908311f4 objc_msgSend + 0x14
1 com.apple.CoreFoundation 0x9019cb2c CFDictionaryAddValue + 0x1f4
2 com.apple.CoreFoundation 0x901b377c CFDictionaryCreateMutableCopy + 0x1f4
3 libsilent.dylib 0x01a6132c Config::WriteInt(char*, char*, int) + 0xb8 (Config.cpp:182)
4 com.PrivateMoon.Agon 0x0003f1a0 _ZN12SoundManagerD4Ev + 0x5c (SoundManager.cpp:62)
5 com.PrivateMoon.Agon 0x00009d24 AGON::Stop() + 0x70 (AGON.cpp:206)
6 libsilent.dylib 0x01aaa838 -[SiLApp stopEngine] + 0x5c (SiLApp.m:131)
7 com.apple.Foundation 0x909f7184 _nsnote_callback + 0xb0
8 com.apple.CoreFoundation 0x901aa5c8 __CFXNotificationPost + 0x1b4
9 com.apple.CoreFoundation 0x901aefd8 _CFXNotificationPostNotification + 0x340
10 com.apple.Foundation 0x909f4fd0 -[NSNotificationCenter postNotificationName:object:userInfo:] + 0x74
11 com.apple.AppKit 0x92eada90 -[NSApplication terminate:] + 0xe4
12 libsilent.dylib 0x01aaa9ec -[SiLApp idle:] + 0x114 (SiLApp.m:185)
13 com.apple.Foundation 0x909f30e4 __NSFireTimer + 0x68
14 com.apple.CoreFoundation 0x90194620 __CFRunLoopDoTimer + 0xf4
15 com.apple.CoreFoundation 0x90191980 __CFRunLoopRun + 0x5c8
16 com.apple.CoreFoundation 0x90195e94 CFRunLoopRunSpecific + 0x148
17 com.apple.HIToolbox 0x927d5f88 RunCurrentEventLoopInMode + 0xac
18 com.apple.HIToolbox 0x927dc6f0 ReceiveNextEventCommon + 0x17c
19 com.apple.HIToolbox 0x927fe6c8 BlockUntilNextEventMatchingListInMode + 0x60
20 com.apple.AppKit 0x92dd227c _DPSNextEvent + 0x180
21 com.apple.AppKit 0x92de8c24 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 0x74
22 com.apple.AppKit 0x92dfcf8c -[NSApplication run] + 0x21c
23 com.apple.AppKit 0x92eb948c NSApplicationMain + 0x1d0
24 com.PrivateMoon.Agon 0x000098a4 main + 0x88 (AGON.cpp:62)
25 com.PrivateMoon.Agon 0x000092b0 _start + 0x188 (crt.c:267)
26 dyld 0x8fe1a558 _dyld_start + 0x64
Tips?
Best regards,
Gábor
_______________________________________________
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