Correct the memory management of XWindowBuffer.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/trunk@28141 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Fred Kiefer 2009-03-27 23:16:48 +00:00
parent 76a7888859
commit 4f3b8457a3
4 changed files with 15 additions and 17 deletions

View file

@ -1,3 +1,10 @@
2009-03-28 Fred Kiefer <FredKiefer@gmx.de>
* Source/x11/XWindowBuffer.m (+windowBufferForWindow:depthInfo:):
Return an autorelease instance.
* Source/cairo/XGCairoXImageSurface.m (-initWithDevice:),
* Source/art/ARTGState.m (-GSSetDevice:): Adopt callers.
2009-03-12 Fred Kiefer <FredKiefer@gmx.de>
* Source/x11/XGServerEvent.m: Correct formatting.

View file

@ -618,7 +618,6 @@ draw_info_t ART_DI;
-(void) GSSetDevice: (gswindow_device_t *)window : (int)x : (int)y
{
struct XWindowBuffer_depth_info_s di;
XWindowBuffer *new_wi;
[self setOffset: NSMakePoint(x, y)];
@ -628,16 +627,8 @@ draw_info_t ART_DI;
di.bytes_per_pixel = DI.bytes_per_pixel;
di.inline_alpha = DI.inline_alpha;
di.inline_alpha_ofs = DI.inline_alpha_ofs;
new_wi = [XWindowBuffer windowBufferForWindow: window depthInfo: &di];
if (new_wi != wi)
{
DESTROY(wi);
wi = new_wi;
}
else
{
DESTROY(new_wi);
}
ASSIGN(wi, [XWindowBuffer windowBufferForWindow: window depthInfo: &di]);
}
-(void) GSCurrentDevice: (void **)device : (int *)x : (int *)y
@ -652,9 +643,9 @@ draw_info_t ART_DI;
if (device)
{
if (wi)
*device = wi->window;
*device = wi->window;
else
*device = NULL;
*device = NULL;
}
}

View file

@ -48,13 +48,13 @@
}
di.drawing_depth = GSWINDEVICE->depth;
// FIXME: The next four lines may be wrong for depth <> 32.
// FIXME: The next lines may be wrong for depth <> 32.
// But then art uses a depth of 24 for 32 bit modes. Strange!
di.bytes_per_pixel = 4;
di.inline_alpha = YES;
di.inline_alpha_ofs = 0;
// FIXME: This method is somewhat special as it does not return an autoreleased object
wi = [XWindowBuffer windowBufferForWindow: GSWINDEVICE depthInfo: &di];
ASSIGN(wi, [XWindowBuffer windowBufferForWindow: GSWINDEVICE depthInfo: &di]);
_surface = cairo_image_surface_create_for_data((unsigned char*)wi->data,
CAIRO_FORMAT_ARGB32,

View file

@ -412,7 +412,7 @@ no_xshm:
wi->data = NULL;
}
return wi;
return AUTORELEASE(wi);
}