aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/opencv/opencv/debian/300_fix_segfault_in_window_gtk.diff
blob: 9391eec7ca52564a54001e3676757627a6fec40e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
--- opencv-1.0.0.orig/otherlibs/highgui/window_gtk.cpp
+++ opencv-1.0.0/otherlibs/highgui/window_gtk.cpp
@@ -333,8 +333,10 @@
 		  GDK_RGB_DITHER_MAX, image_widget->scaled_image->data.ptr, image_widget->scaled_image->step );
   }
   else if( image_widget->original_image ){
-	  gdk_draw_rgb_image( widget->window, widget->style->fg_gc[GTK_STATE_NORMAL],
-		  0, 0, widget->allocation.width, widget->allocation.height,
+		  gdk_draw_rgb_image( widget->window, widget->style->fg_gc[GTK_STATE_NORMAL],
+		  0, 0, 
+		  MIN(image_widget->original_image->cols, widget->allocation.width), 
+		  MIN(image_widget->original_image->rows, widget->allocation.height), 
 		  GDK_RGB_DITHER_MAX, image_widget->original_image->data.ptr, image_widget->original_image->step );
   }
   return TRUE;