]> Pileus Git - ~andy/gtk/blobdiff - gdk/gdkpixmap.c
Disconnect from combo->entry, not combo. (From: Daniel Skarda
[~andy/gtk] / gdk / gdkpixmap.c
index 6fbdada88065612dc0d34d4703e06d5915b35770..1ec059cda17ff94063da8020d9001386828b8a05 100644 (file)
@@ -473,7 +473,7 @@ gdk_pixmap_colormap_create_from_xpm (GdkWindow   *window,
                       color = NULL;
                       ns = 0;
 
-                      while (color == NULL)
+                      while ((color == NULL) && (ns < num_cols))
                         {
                           if (strcmp (pixel_str, colors[ns].color_string) == 0)
                             color = &colors[ns];
@@ -481,6 +481,9 @@ gdk_pixmap_colormap_create_from_xpm (GdkWindow   *window,
                             ns++;
                         }
 
+                     if (!color) /* screwed up XPM file */
+                       color = &colors[0];
+
                       gdk_image_put_pixel (image, xcnt, ycnt, color->color.pixel);
 
                      if (mask && color->transparent)
@@ -643,7 +646,7 @@ gdk_pixmap_colormap_create_from_xpm_d (GdkWindow  *window,
          color = NULL;
          ns = 0;
 
-         while (color == NULL)
+         while ((color == NULL) && (ns < num_cols))
            {
              if (strcmp (pixel_str, colors[ns].color_string) == 0)
                color = &colors[ns];
@@ -651,6 +654,9 @@ gdk_pixmap_colormap_create_from_xpm_d (GdkWindow  *window,
                ns++;
            }
 
+         if (!color) /* screwed up XPM file */
+           color = &colors[0];
+
          gdk_image_put_pixel (image, xcnt, ycnt, color->color.pixel);
 
          if (mask && color->transparent)