|
From: | Fred Kiefer |
Subject: | Re: [NSWindow _initBackendWindow] segmentation fault ... |
Date: | Sun, 27 Feb 2005 20:42:26 +0100 |
User-agent: | Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.2) Gecko/20040906 |
Christophe JALADY wrote:
I've a segmentation fault on: [NSWindow _initBackendWindow] at NSWindow.m:791 The line in the file is this one: ... // Set window in new _gstate DPSgsave(context); ... With ddd, I found that "context" is nil (0x0) but it initialised with that : "NSGraphicsContext *context = GSCurrentContext();". So what are reason's that GSCurrentContext can return nil ? To know, my last application call is a [NSImage lockFocus] with an NSimage wich is init with "initWithSize" and wich respond "false" to isValid (is it normal?). With the call to "lockFocus" I've the segmentation fault describe above. Thank's in advance for your help. Christophe. ps: I use the "current release" of GNUStep. I try both with art and xlib backend but I've the same bug.My application is a port of a MAC/COCOA to gnustep. It have 2 threads.
Without seeing your code it is hard to tell the reason for the problem. One possibility is that you did not initialize the backend, that is you did not call [NSApplication sharedApplication] one way or the other. Another possibility is that you are making this call from the second thread, the one not used to initialize the backend. GSCurrentContext() gets the context from the current thread, so it will fail when used with a secondardy thread. You may work around this problem by using
[NSObject performSelectorOnMainThread:withObject:waitUntilDone:]. Fred
[Prev in Thread] | Current Thread | [Next in Thread] |