7

While attempting to write a simple Cocoa/Applescript with a custom background (following this tutorial, http://www.mere-mortal-software.com/blog/details.php?d=2007-01-08), I get the following error every now and then in the debugger:

Error>: kCGErrorIllegalArgument: _CGSFindSharedWindow: WID 3162
Media Center[10234] <Error>: kCGErrorFailure: Set a breakpoint @ CGErrorBreakpoint() to catch errors as they are logged.

So I set a breakpoint at CGErrorBreakpoint and I got the following results:

Thread 1, Queue : com.apple.main-thread
#1  0x00007fff92ba4112 in CGSGlobalErrorv ()
#2  0x00007fff92c7ca25 in _CGSFindSharedWindow ()
#3  0x00007fff92b275a9 in _CGSWindowByID ()
#4  0x00007fff92c2cdf9 in CGSOrderFrontConditionally ()
#5  0x00007fff93ce1ecf in __-[NSApplication _copyBatchWindowOrderingPerformerForToken:release:]_block_invoke_2 ()
#6  0x00007fff93d0f685 in -[NSPersistentUIManager resumeNormalWindowOrderingAndDrawing] ()
#7  0x00007fff93d0f52f in -[NSPersistentUIManager tearDownStateRestorationApparatusAndResumeWindowOrdering] ()
#8  0x00007fff93d0f374 in -[NSPersistentUIManager finishedRestoringWindowsWithZOrder:registerAsReady:completionHandler:] ()
#9  0x00007fff944f25ed in __-[NSPersistentUIManager restoreAllPersistentStateWithTalagentWindows:registeringAsReadyWhenDone:completionHandler:]_block_invoke_3 ()
#10 0x00007fff944f4080 in __-[NSPersistentUIManager restoreAllPersistentStateWithTalagentWindows:registeringAsReadyWhenDone:completionHandler:]_block_invoke_2 ()
#11 0x00007fff93f323e8 in __-[NSApplication(NSPersistentUISupport) _restoreWindowWithRestoration:handler:]_block_invoke_1 ()
#12 0x00007fff944f2760 in __-[NSApplication(NSPersistentUISupport) _restoreWindowWithRestoration:handler:]_block_invoke_3 ()
#13 0x00007fff94c2e44c in __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ ()
#14 0x00007fff94be6562 in __CFRunLoopDoBlocks ()
#15 0x00007fff94c0e195 in __CFRunLoopRun ()
#16 0x00007fff94c0dae6 in CFRunLoopRunSpecific ()
#17 0x00007fff8cfdf3d3 in RunCurrentEventLoopInMode ()
#18 0x00007fff8cfe658f in ReceiveNextEventCommon ()
#19 0x00007fff8cfe64ca in BlockUntilNextEventMatchingListInMode ()
#20 0x00007fff93cdc3f1 in _DPSNextEvent ()
#21 0x00007fff93cdbcf5 in -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] ()
#22 0x00007fff93cd862d in -[NSApplication run] ()
Thread 2, Queue : (null)
Thread 3, Queue : com.apple.libdispatch-manager
Thread 4, Queue : (null)
Thread 6, Queue : (null)
Thread 7, Queue : (null)

I'm not entirely sure how to remedy this, and I'll provide more output info if requested.

Edit: If you open the app while the dock is shown, I get the error. If the dock is not shown, it usually works.

4
  • I am getting the same error in a rather simple app- looking forward to see if you get a response.
    – leecbaker
    Feb 2, 2012 at 0:13
  • Same, this app is really straightforward. Upvote the question if you like it :D A little disappointed no ones answered yet...
    – Charlie
    Feb 3, 2012 at 1:52
  • Can not believe no one answered. Is this really that rare?
    – Charlie
    Feb 5, 2012 at 18:23
  • @Charlie No, not really, but you could consider setting a bounty to make it appear in the 'featured' list or editing the question so it reappears in the 'active' list.
    – 11684
    Feb 26, 2013 at 15:57

2 Answers 2

4

I had a problem similar to that. Have you tried checking the 'release when closed' checkbox in your window's attribute panel?

0
1

I had the same issue. I created a window controller in code from a nib file, then I called the showWindow: method and released the window controller. (Both release and autorelease caused the same issue.) Coming form the iOS world I thought when I show a window this will increment the retain count of the controller and it will be alright until it is closed. As it proved, this is not how it works, so you have to keep a reference to this controller until the window is open.

I hope this helped,

raliz

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.