Strange problem with NSNotificationCenter and NPAPI plugin
Strange problem with NSNotificationCenter and NPAPI plugin
- Subject: Strange problem with NSNotificationCenter and NPAPI plugin
- From: vinay prabhu <email@hidden>
- Date: Thu, 23 Apr 2009 18:12:07 +0530
Hi All,
The problem I am about to explain is related to NPAPI plugin + Safari.
But the actual problem what I want to discuss is related to
NSNotificationCenter.
So I am posting in this forum. Please pardon me if this is the wrong forum
to post this issue.
I am developing a NPAPI plugin, which is mainly intended to run on both
Safari and Firefox.
On Safari, plugin was crashing while quitting the browser.
Upon investigating the crash, I found that commenting out a
[NSNotificationCenter addObserver:] eliminates the crash.
Obviously a cocoa call should not do any harm.
So on further investigation, I have found that.
If I use an underscore "_", in the notification name, Safari was crashing.
If I do not use the underscore then there is no crash.
This looked more weird than the problem.
So on further investigating the problem, by using different special
characters in the notification name, it is observed that, safari crashes for
only notification name with underscore.
Strangely I have used the notification name as "___" 3 underscores, then
there is no crash.
Here is the pattern with which I had tried the notification.
"_" only one underscore, safari crashes.
"__" two underscores, safari do not crash.
"__*" two underscores and a star, safari crashes.
"TEST_TEST_TEST" for this name, safari crashes.
This looks too strange, can any one enlighten me with what is happening
here.
What is the relation between, underscore and the notification name?
How an underscore causes the memory corruption?
Thanks
Vinay
Crash log:
Thread 0 Crashed:
0 com.apple.CoreFoundation 0x941b0016 CFEqual + 38
1 com.apple.CoreFoundation 0x9417f7f5 __CFDictionaryFindBuckets1b
+ 293
2 com.apple.CoreFoundation 0x9418001d CFDictionaryGetValue + 141
3 com.apple.CoreFoundation 0x941900c8 _CFXNotificationUnregister
+ 280
4 com.apple.Foundation 0x96871a9e -[NSNotificationCenter
removeObserver:name:object:] + 110
5 com.apple.AppKit 0x906ef7f5
-[NSNotificationCenter(NSNotificationCenterAppKitExtensions)
_removeObserver:notificationNamesAndSelectorNames:object:] + 109
6 com.apple.AppKit 0x9079daa3 -[NSWindow setDelegate:] +
779
7 com.apple.Safari 0x0000ec43 0x1000 + 56387
8 com.apple.AppKit 0x9087f866 -[NSWindowController
dealloc] + 197
9 com.apple.Safari 0x0003ba5d 0x1000 + 240221
10 com.apple.Safari 0x0003b814 0x1000 + 239636
11 com.apple.AppKit 0x9079255a -[NSWindowController
release] + 158
12 com.apple.Safari 0x0003a8a4 0x1000 + 235684
13 com.apple.Safari 0x0003a802 0x1000 + 235522
14 com.apple.CoreFoundation 0x9421bc45 -[NSArray
makeObjectsPerformSelector:] + 565
15 com.apple.AppKit 0x908b0c57 -[NSApplication
_deallocHardCore:] + 433
16 com.apple.AppKit 0x908af975 -[NSApplication terminate:]
+ 742
17 com.apple.AppKit 0x907d053b -[NSApplication
sendAction:to:from:] + 112
18 com.apple.Safari 0x0002c948 0x1000 + 178504
19 com.apple.AppKit 0x9087f17c -[NSMenu
performActionForItemAtIndex:] + 493
20 com.apple.AppKit 0x9087ee81 -[NSCarbonMenuImpl
performActionWithHighlightingForItemAtIndex:] + 220
21 com.apple.AppKit 0x9087eb07 -[NSMenu
performKeyEquivalent:] + 866
22 com.apple.AppKit 0x9087d3ac -[NSApplication
_handleKeyEquivalent:] + 492
23 com.apple.AppKit 0x9079a16b -[NSApplication sendEvent:]
+ 3999
24 com.apple.Safari 0x0002ab58 0x1000 + 170840
25 com.apple.AppKit 0x906f769f -[NSApplication run] + 847
26 com.apple.AppKit 0x906c48a4 NSApplicationMain + 574
27 com.apple.Safari 0x000b9b16 0x1000 + 756502
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden