From f6a173d30258c0d8552d987a6347d0f19c7a4fed Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Tue, 23 Feb 2010 13:05:24 -0500 Subject: [PATCH] Catch directfb errors in gdk_colormap_new Patch by Andre Draszik, bug 609172. --- gdk/directfb/gdkcolor-directfb.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/gdk/directfb/gdkcolor-directfb.c b/gdk/directfb/gdkcolor-directfb.c index 298013346e..86f68da1ed 100644 --- a/gdk/directfb/gdkcolor-directfb.c +++ b/gdk/directfb/gdkcolor-directfb.c @@ -119,9 +119,16 @@ gdk_colormap_new (GdkVisual *visual, { case GDK_VISUAL_PSEUDO_COLOR: { + IDirectFB *dfb = _gdk_display->directfb; + IDirectFBPalette *palette; GdkColormapPrivateDirectFB *private; DFBPaletteDescription dsc; + dsc.flags = DPDESC_SIZE; + dsc.size = colormap->size; + if (!dfb->CreatePalette (dfb, &dsc, &palette)) + return NULL; + colormap->colors = g_new0 (GdkColor, colormap->size); private = g_new0 (GdkColormapPrivateDirectFB, 1); @@ -133,10 +140,7 @@ gdk_colormap_new (GdkVisual *visual, private->info[0].ref_count++; } - dsc.flags = DPDESC_SIZE; - dsc.size = colormap->size; - _gdk_display->directfb->CreatePalette ( - _gdk_display->directfb, &dsc, &private->palette); + private->palette = palette; colormap->windowing_data = private;