Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3407540
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T05:45:48+00:00 2026-05-18T05:45:48+00:00

The Thread Safety Summary on developer.apple.com states that NSWindow’s are thread safe* and can

  • 0

The Thread Safety Summary on developer.apple.com states that NSWindow’s are thread safe* and can be created from worker threads.

I have a worker thread that i’ve created rather simply:

  [NSThread detachNewThreadSelector:@selector(threadProc:)
                           toTarget:self
                         withObject:nil];

that tries to create a NSWindow. I used to marshal the create call onto the main thread and it worked, reading the Thread Safety Summary I tried simply creating it on the worker thread but I get this crash:

Thu Oct 28 15:13:15 trans.mshome.net MyApp[99962] <Error>: kCGErrorRangeCheck: CGSNewWindowWithOpaqueShape: Cannot create window
Thu Oct 28 15:13:15 trans.mshome.net MyApp[99962] <Error>: kCGErrorFailure: Set a breakpoint @ CGErrorBreakpoint() to catch errors as they are logged.
2010-10-28 15:13:15.192 MyApp[99962:5903] An uncaught exception was raised
2010-10-28 15:13:15.194 MyApp[99962:5903] Error (1007) creating CGSWindow
2010-10-28 15:13:15.195 MyApp[99962:5903] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Error (1007) creating CGSWindow'
*** Call stack at first throw:
(
    0   CoreFoundation                      0x91b5ebba __raiseError + 410
    1   libobjc.A.dylib                     0x96e9c509 objc_exception_throw + 56
    2   CoreFoundation                      0x91b5e8e8 +[NSException raise:format:arguments:] + 136
    3   CoreFoundation                      0x91b5e85a +[NSException raise:format:] + 58
    4   AppKit                              0x94e5ac2d _NXCreateWindow + 316
    5   AppKit                              0x94e5aa38 _NSCreateWindow + 59
    6   AppKit                              0x94e59c5e -[NSWindow _commonAwake] + 1784
    7   AppKit                              0x94e56886 -[NSWindow _commonInitFrame:styleMask:backing:defer:] + 1524
    8   AppKit                              0x94e554d9 -[NSWindow _initContent:styleMask:backing:defer:contentView:] + 1568
    9   AppKit                              0x94e54eb3 -[NSWindow initWithContentRect:styleMask:backing:defer:] + 71
    10  acmeFrame.dylib                     0x028e300b _ZN11Acme12CCocoaWindow12CreateWindowEPKciiiij + 517
    18  acmeFrame.dylib                     0x00011ac4 -[CocoaThread threadProc:] + 136
    19  Foundation                          0x92dd28d4 -[NSThread main] + 45
    20  Foundation                          0x92dd2884 __NSThread__main__ + 1499
    21  libSystem.B.dylib                   0x94b3b81d _pthread_start + 345
    22  libSystem.B.dylib                   0x94b3b6a2 thread_start + 34

Correction: It states that NSWindow objects are thread-unsafe – i.e. they can be accessed from multiple thread, but access to them must be serialized. Under "Window Restrictions" it however does state that windows CAN be created from a secondary thread.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T05:45:49+00:00Added an answer on May 18, 2026 at 5:45 am

    As it turns out, that crash happens if the size of the frame rect passed to NSWindow is invalid, regardless of the thread its called from.

    As it turns out, my frame size was uninitialized, and the value was coincidentally ‘legit’ when I created the window from the main thread.

    With a valid size, all threads seem capable of calling [NSWindow initWithContentRect:].

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We're all familiar with the horror that is C# event declaration. To ensure thread-safety,
Any suggestions on the best way to ensure thread safety when changing the properties
What is the difference between the concepts of Code Re-entrancy and Thread Safety ?
I'm looking for articles, forum or blog posts dealing with SharePoint and thread safety?
How does const (pointers, references and member functions) help with thread safety in C++?
Can Thread.getContextClassLoader() be null ? The javadoc is not really clear. Should a library
I have one thread that writes results into a Queue. In another thread (GUI),
Is Bouncy Castle API Thread Safe ? Especially, org.bouncycastle.crypto.paddings.PaddedBufferedBlockCipher org.bouncycastle.crypto.paddings.PKCS7Padding org.bouncycastle.crypto.engines.AESFastEngine org.bouncycastle.crypto.modes.CBCBlockCipher I am
I was browsing this thread , which has good recommendation but a bit too
When launching a thread or a process in .NET or Java, is there a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.