Author: ianmacarthur
Date: 2010-05-13 00:47:30 -0700 (Thu, 13 May 2010)
New Revision: 7605
Log:

Make sure that "transparent_c" is not NULL before it is used in win32 builds.
Prevents segfault when loading pixmpas that have no transparent cell set.



Modified:
   branches/branch-1.3/src/fl_draw_pixmap.cxx

Modified: branches/branch-1.3/src/fl_draw_pixmap.cxx
===================================================================
--- branches/branch-1.3/src/fl_draw_pixmap.cxx  2010-05-12 04:59:52 UTC (rev 
7604)
+++ branches/branch-1.3/src/fl_draw_pixmap.cxx  2010-05-13 07:47:30 UTC (rev 
7605)
@@ -222,7 +222,7 @@
   if (!fl_measure_pixmap(cdata, d.w, d.h)) return 0;
   const uchar*const* data = (const uchar*const*)(cdata+1);
   int transparent_index = -1;
-  uchar *transparent_c; // such that transparent_c[0,1,2] are the RGB of the 
transparent color
+  uchar *transparent_c = (uchar *)0; // such that transparent_c[0,1,2] are the 
RGB of the transparent color
 #ifdef WIN32
   color_count = 0;
   used_colors = (uchar *)malloc(abs(ncolors)*3*sizeof(uchar));
@@ -335,7 +335,10 @@
   }
   d.data = data;
 #ifdef WIN32
-    make_unused_color(transparent_c[0], transparent_c[1], transparent_c[2]);
+    if(transparent_c){
+      // only make a transparent color if one is defined
+      make_unused_color(transparent_c[0], transparent_c[1], transparent_c[2]);
+    }
 #endif
 #ifndef __APPLE_QUARTZ__
 

_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit

Reply via email to