Skip to content

Commit aa75b60

Browse files
authored
gtk: check NULL before unref
1 parent 3248518 commit aa75b60

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

modules/highgui/src/window_gtk.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -951,7 +951,8 @@ static gboolean cvImageWidget_draw(GtkWidget* widget, cairo_t *cr, gpointer data
951951
}
952952

953953
cairo_paint(cr);
954-
g_object_unref(pixbuf);
954+
if(pixbuf)
955+
g_object_unref(pixbuf);
955956
return TRUE;
956957
}
957958

@@ -1005,7 +1006,8 @@ static gboolean cvImageWidget_expose(GtkWidget* widget, GdkEventExpose* event, g
10051006
}
10061007

10071008
cairo_paint(cr);
1008-
g_object_unref(pixbuf);
1009+
if(pixbuf)
1010+
g_object_unref(pixbuf);
10091011
cairo_destroy(cr);
10101012
return TRUE;
10111013
}

0 commit comments

Comments
 (0)