[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug #25943] Error trying to lock focus in offscreen window
From: |
Doug Simons |
Subject: |
[bug #25943] Error trying to lock focus in offscreen window |
Date: |
Fri, 20 Mar 2009 18:31:29 +0000 |
User-agent: |
Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_4_11; en) AppleWebKit/525.27.1 (KHTML, like Gecko) Version/3.2.1 Safari/525.27.1 |
URL:
<http://savannah.gnu.org/bugs/?25943>
Summary: Error trying to lock focus in offscreen window
Project: GNUstep
Submitted by: theeggcamefirst
Submitted on: Fri 20 Mar 2009 06:31:27 PM GMT
Category: Gui/AppKit
Severity: 3 - Normal
Item Group: Bug
Status: None
Privacy: Public
Assigned to: None
Open/Closed: Open
Discussion Lock: Any
_______________________________________________________
Details:
I have the following two lines in my code. The lockFocus causes an exception
inserting nil into an array.
NSWindow *simpleWindow = [[[NSWindow alloc]
initWithContentRect:NSMakeRect(0,0,stringSize.width,stringSize.height)
styleMask:NSBorderlessWindowMask
backing:NSBackingStoreNonretained
defer:NO] autorelease];
[[simpleWindow contentView] lockFocus];
The following gdb transcript may be helpful. The window's frame gets set to
some odd values which looks suspicious but I'm guessing may be an unrelated
problem. I am executing this code in a background thread as you can see below.
I wonder if the fact this is a borderless window or is nonretained has
anything to do with it. This same code works fine in Cocoa.
688 NSWindow *simpleWindow = [[[NSWindow alloc]
initWithContentRect:NSMakeRect(0,0,stringSize.width,stringSize.height)
689
styleMask:NSBorderlessWindowMask
690
backing:NSBackingStoreNonretained
691 defer:NO] autorelease];
(gdb) p stringSize
$22 = {width = 54, height = 17}
(gdb) n
693 [[simpleWindow contentView] lockFocus];
(gdb) p [simpleWindow frame]
$23 = {origin = {x = -1.38111977e-41, y = 0}, size = {width = 53.9999847,
height = 16.9999981}}
(gdb) s
-[NSWindow contentView] (self=0x857e660, _cmd=0x81dde30) at NSWindow.m:1103
1103 return _contentView;
(gdb)
1104 }
(gdb)
-[NSView lockFocus] (self=0x896e5d8, _cmd=0x81dde38) at NSView.m:2178
2178 [self lockFocusInRect: [self visibleRect]];
(gdb) s
-[NSView visibleRect] (self=0x896e5d8, _cmd=0xb7f392e0) at NSView.m:2505
2505 if ([self isHiddenOrHasHiddenAncestor])
(gdb) fin
Run till exit from #0 -[NSView visibleRect] (self=0x896e5d8,
_cmd=0xb7f392e0) at NSView.m:2505
0xb7dd806a in -[NSView lockFocus] (self=0x896e5d8, _cmd=0x81dde38) at
NSView.m:2178
2178 [self lockFocusInRect: [self visibleRect]];
Value returned is $24 =
{origin = {x = 0, y = 2.86850845e-05}, size = {width = 53.9999847, height
= 16.9999981}}
(gdb) s
-[NSView lockFocusInRect:] (self=0x896e5d8, _cmd=0xb7f39648, rect=
{origin = {x = 0, y = 2.86850845e-05}, size = {width = 53.9999847,
height = 16.9999981}})
at NSView.m:2173
2173 [self _lockFocusInContext: nil inRect: rect];
(gdb)
-[NSView _lockFocusInContext:inRect:] (self=0x896e5d8, _cmd=0xb7f39640,
ctxt=0x0, rect=
{origin = {x = 0, y = 2.86850845e-05}, size = {width = 53.9999847,
height = 16.9999981}})
at NSView.m:1917
1917 int window_gstate = 0;
(gdb)
1919 if (viewIsPrinting == nil)
(gdb)
1921 NSAssert(_window != nil, NSInternalInconsistencyException);
(gdb)
1923 if ((window_gstate = [_window gState]) == 0)
(gdb) n
1929 if (ctxt == nil)
(gdb)
1931 if (viewIsPrinting != nil)
(gdb)
1939 ctxt = [_window graphicsContext];
(gdb)
1944 [NSGraphicsContext saveGraphicsState];
(gdb) po ctxt
<ARTContext: 0x898f720>
(gdb) s
+[NSGraphicsContext saveGraphicsState] (self=0xb7ede300, _cmd=0xb7f395b0) at
NSGraphicsContext.m:253
253 NSMutableDictionary *dict = [[NSThread currentThread]
threadDictionary];
(gdb) n
254 NSMutableArray *stack = [dict objectForKey:
NSGraphicsContextStackKey];
(gdb) po dict
{}
(gdb) info thread
* 11 Thread 0xb5fffb90 (LWP 4377) +[NSGraphicsContext saveGraphicsState]
(self=0xb7ede300, _cmd=0xb7f395b0)
at NSGraphicsContext.m:254
10 Thread 0xb6a51b90 (LWP 4376) 0xb7f7c410 in __kernel_vsyscall ()
1 Thread 0xb71f08c0 (LWP 4367) 0xb7f7c410 in __kernel_vsyscall ()
(gdb) n
255 if (stack == nil)
(gdb)
257 stack = [[NSMutableArray allocWithZone: _globalGSZone] init];
(gdb)
258 [dict setObject: stack forKey: NSGraphicsContextStackKey];
(gdb)
260 ctxt = GSCurrentContext();
(gdb)
261 [ctxt saveGraphicsState];
(gdb) po ctxt
Cannot access memory at address 0x0
(gdb) n
262 [stack addObject: ctxt];
(gdb)
688 NSWindow *simpleWindow = [[[NSWindow alloc]
initWithContentRect:NSMakeRect(0,0,stringSize.width,stringSize.height)
689
styleMask:NSBorderlessWindowMask
690
backing:NSBackingStoreNonretained
691 defer:NO] autorelease];
(gdb) p stringSize
$22 = {width = 54, height = 17}
(gdb) n
693 [[simpleWindow contentView] lockFocus];
(gdb) p [simpleWindow frame]
$23 = {origin = {x = -1.38111977e-41, y = 0}, size = {width = 53.9999847,
height = 16.9999981}}
(gdb) s
-[NSWindow contentView] (self=0x857e660, _cmd=0x81dde30) at NSWindow.m:1103
1103 return _contentView;
(gdb)
1104 }
(gdb)
-[NSView lockFocus] (self=0x896e5d8, _cmd=0x81dde38) at NSView.m:2178
2178 [self lockFocusInRect: [self visibleRect]];
(gdb) s
-[NSView visibleRect] (self=0x896e5d8, _cmd=0xb7f392e0) at NSView.m:2505
2505 if ([self isHiddenOrHasHiddenAncestor])
(gdb) fin
Run till exit from #0 -[NSView visibleRect] (self=0x896e5d8,
_cmd=0xb7f392e0) at NSView.m:2505
0xb7dd806a in -[NSView lockFocus] (self=0x896e5d8, _cmd=0x81dde38) at
NSView.m:2178
2178 [self lockFocusInRect: [self visibleRect]];
Value returned is $24 =
{origin = {x = 0, y = 2.86850845e-05}, size = {width = 53.9999847, height
= 16.9999981}}
(gdb) s
-[NSView lockFocusInRect:] (self=0x896e5d8, _cmd=0xb7f39648, rect=
{origin = {x = 0, y = 2.86850845e-05}, size = {width = 53.9999847,
height = 16.9999981}})
at NSView.m:2173
2173 [self _lockFocusInContext: nil inRect: rect];
(gdb)
-[NSView _lockFocusInContext:inRect:] (self=0x896e5d8, _cmd=0xb7f39640,
ctxt=0x0, rect=
{origin = {x = 0, y = 2.86850845e-05}, size = {width = 53.9999847,
height = 16.9999981}})
at NSView.m:1917
1917 int window_gstate = 0;
(gdb)
1919 if (viewIsPrinting == nil)
(gdb)
1921 NSAssert(_window != nil, NSInternalInconsistencyException);
(gdb)
1923 if ((window_gstate = [_window gState]) == 0)
(gdb) n
1929 if (ctxt == nil)
(gdb)
1931 if (viewIsPrinting != nil)
(gdb)
1939 ctxt = [_window graphicsContext];
(gdb)
1944 [NSGraphicsContext saveGraphicsState];
(gdb) po ctxt
<ARTContext: 0x898f720>
(gdb) s
+[NSGraphicsContext saveGraphicsState] (self=0xb7ede300, _cmd=0xb7f395b0) at
NSGraphicsContext.m:253
253 NSMutableDictionary *dict = [[NSThread currentThread]
threadDictionary];
(gdb) n
254 NSMutableArray *stack = [dict objectForKey:
NSGraphicsContextStackKey];
(gdb) po dict
{}
(gdb) info thread
* 11 Thread 0xb5fffb90 (LWP 4377) +[NSGraphicsContext saveGraphicsState]
(self=0xb7ede300, _cmd=0xb7f395b0)
at NSGraphicsContext.m:254
10 Thread 0xb6a51b90 (LWP 4376) 0xb7f7c410 in __kernel_vsyscall ()
1 Thread 0xb71f08c0 (LWP 4367) 0xb7f7c410 in __kernel_vsyscall ()
(gdb) n
255 if (stack == nil)
(gdb)
257 stack = [[NSMutableArray allocWithZone: _globalGSZone] init];
(gdb)
258 [dict setObject: stack forKey: NSGraphicsContextStackKey];
(gdb)
260 ctxt = GSCurrentContext();
(gdb)
261 [ctxt saveGraphicsState];
(gdb) po ctxt
Cannot access memory at address 0x0
(gdb) n
262 [stack addObject: ctxt];
(gdb)
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?25943>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
- [bug #25943] Error trying to lock focus in offscreen window,
Doug Simons <=