What's the proper way of creating a temporary NSWindow from a Carbon window?
What's the proper way of creating a temporary NSWindow from a Carbon window?
- Subject: What's the proper way of creating a temporary NSWindow from a Carbon window?
- From: Jonathan del Strother <email@hidden>
- Date: Fri, 6 May 2005 15:10:08 +0100
My iTunes plugin needs a list of supported resolutions from the
screen that the iTunes window is on.
It's doing this by creating an NSWindow using initWithWindowRef.
NSWindow* iTunesWindow = [[NSWindow alloc]
initWithWindowRef:FrontWindow()];
Once this code is executed, clicking the close button no longer has
any effect.
So, I'd like to release NSWindow's hold on the Carbon windowRef.
However, releasing the NSWindow appears to destroy the carbon
window...this code:
NSWindow* iTunesWindow = [[NSWindow alloc]
initWithWindowRef:FrontWindow()];
[iTunesWindow release];
results in the crash I've pasted below.
Is this expected behavior? Is there any way around it?
Any help would be appreciated. I'm getting nowhere on this...
Jon
Exception: EXC_BAD_ACCESS (0x0001)
Codes: KERN_INVALID_ADDRESS (0x0001) at 0xffffffff
Thread 0 Crashed:
0 com.apple.QD 0x916a3828 RectRgn + 96
1 com.apple.iTunes 0x0006cc14 dyld_stub_binding_helper
+ 427708
2 com.apple.iTunes 0x0013d9d0 dyld_stub_binding_helper
+ 1283192
3 com.apple.iTunes 0x0013e11c dyld_stub_binding_helper
+ 1285060
4 com.apple.iTunes 0x0014e4e4 dyld_stub_binding_helper
+ 1351564
5 com.apple.iTunes 0x000fc47c dyld_stub_binding_helper
+ 1015588
6 com.apple.iTunes 0x000fc36c dyld_stub_binding_helper
+ 1015316
7 com.apple.iTunes 0x002805f0 dyld_stub_binding_helper
+ 2605208
8 com.apple.iTunes 0x00280eb8 dyld_stub_binding_helper
+ 2607456
9 com.apple.iTunes 0x00281500 dyld_stub_binding_helper
+ 2609064
10 com.apple.iTunes 0x0017237c dyld_stub_binding_helper
+ 1498660
11 com.apple.iTunes 0x00281da8 dyld_stub_binding_helper
+ 2611280
12 com.apple.iTunes 0x000044d0 __code_start__ + 432
13 com.apple.iTunes 0x00004350 __code_start__ + 48
Thread 1:
0 libSystem.B.dylib 0x9000a758 mach_msg_trap + 8
1 libSystem.B.dylib 0x9000a69c mach_msg + 60
2 com.apple.CoreFoundation 0x9074a5b8 __CFRunLoopRun + 832
3 com.apple.CoreFoundation 0x90749ebc CFRunLoopRunSpecific + 268
4 com.apple.CoreFoundation 0x9075931c CFRunLoopRun + 52
5 com.apple.iTunes 0x001d1e70 dyld_stub_binding_helper
+ 1890584
6 libSystem.B.dylib 0x9002c3b4 _pthread_body + 96
Thread 2:
0 libSystem.B.dylib 0x9001efcc select + 12
1 com.apple.CoreFoundation 0x9075ce4c __CFSocketManager + 472
2 libSystem.B.dylib 0x9002c3b4 _pthread_body + 96
Thread 3:
0 libSystem.B.dylib 0x9000a758 mach_msg_trap + 8
1 libSystem.B.dylib 0x9000a69c mach_msg + 60
2 com.apple.opengl 0x9357cf64 glcDebugListener + 252
3 libSystem.B.dylib 0x9002c3b4 _pthread_body + 96
Thread 4:
0 libSystem.B.dylib 0x90042ac8 mach_wait_until + 8
1 libSystem.B.dylib 0x90042880 nanosleep + 384
2 libSystem.B.dylib 0x9004675c usleep + 60
3 com.steelskies.GasLight 0x01754b74 RenderThread + 176
(main.c:39)
4 libSystem.B.dylib 0x9002c3b4 _pthread_body + 96
_______________________________________________
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