[cairo-commit] src/cairo-win32-surface.c
Vladimir Vukicevic
vladimir at kemper.freedesktop.org
Tue Mar 25 11:54:02 PDT 2008
src/cairo-win32-surface.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
New commits:
commit 8aba5b802946530ef481f1461f9894529498cd8a
Author: Vladimir Vukicevic <vladimir at pobox.com>
Date: Tue Mar 25 11:53:52 2008 -0700
[win32] Prevent crash in create_similar if win32_surface_create fails
diff --git a/src/cairo-win32-surface.c b/src/cairo-win32-surface.c
index 5719c6d..bfe71b4 100644
--- a/src/cairo-win32-surface.c
+++ b/src/cairo-win32-surface.c
@@ -410,9 +410,15 @@ _cairo_win32_surface_create_similar_internal (void *abstract_src,
saved_dc_bitmap = SelectObject (ddb_dc, ddb);
new_surf = (cairo_win32_surface_t*) cairo_win32_surface_create (ddb_dc);
- new_surf->bitmap = ddb;
- new_surf->saved_dc_bitmap = saved_dc_bitmap;
- new_surf->is_dib = FALSE;
+ if (new_surf->base.status == CAIRO_STATUS_SUCCESS) {
+ new_surf->bitmap = ddb;
+ new_surf->saved_dc_bitmap = saved_dc_bitmap;
+ new_surf->is_dib = FALSE;
+ } else {
+ SelectObject (ddb_dc, saved_dc_bitmap);
+ DeleteDC (ddb_dc);
+ DeleteObject (ddb);
+ }
}
return (cairo_surface_t*) new_surf;
More information about the cairo-commit
mailing list