Check if the window and it's gstate exist before undefining the gstate.

Patch by Georg Fleischmann <G.Fleischmann@vhf.de>.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@31350 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
fredkiefer 2010-09-15 08:21:32 +00:00
parent c75954f582
commit ce2180918a
2 changed files with 20 additions and 4 deletions

View file

@ -383,6 +383,12 @@ GSSetDragTypes(NSView* obj, NSArray *types)
{
return;
}
// This call also reset _allocate_gstate, but then want
// would that setting mean in a different window?
// This way we keep the logic in one place.
[self releaseGState];
if (_coordinates_valid)
{
(*invalidateImp)(self, invalidateSel);
@ -2183,8 +2189,11 @@ convert_rect_using_matrices(NSRect aRect, NSAffineTransform *matrix1,
*/
- (void) releaseGState
{
if (_allocate_gstate && _gstate)
GSUndefineGState([_window graphicsContext], _gstate);
if (_allocate_gstate && _gstate &&
_window && ([_window graphicsContext] != nil))
{
GSUndefineGState([_window graphicsContext], _gstate);
}
_gstate = 0;
_allocate_gstate = NO;
}