tags 576624 patch
thanks

The attached patch will fix both problems for
vte_terminal_set_background_image_file() and
vte_terminal_set_background_transparent().

Upstream git codebase has changed much, so I will not send this patch to
upstream.

The most easy way to test the patch:
1. run Xephyr (and do not set any background)

2. run evilvte in Sid(and Sueeze)

3. Right-click in evilvte and select "Toggle background"

   It is cycled by the sequence:
    "background image at $HOME/.config/evilvte/background.png",
    "pseudo transparency",
    "no background and no transparency (aka black)"

   When there is no $HOME/.config/evilvte/background.png,
   evilvte will show nothing as background(aka black).

   You may link any image file to $HOME/.config/evilvte/background.png.
   (All image formats that can be processed by GTK+, not only png.)

4. Everything should be fine with the patch.

Kind regards
 Wen-Yen Chuang (caleb)
GNOME #614910; set_background_image does not accept None in Python bindings
Debian #576624; Segfault when loading the background pixbuf failed
Patch author: Tetralet <tetralet AT gmail DOT com>

--- vte-0.24.0.orig/src/vtebg.c
+++ vte-0.24.0/src/vtebg.c
@@ -469,6 +469,8 @@
 			item->source_file = g_strdup(source_file);
 			pixbuf = gdk_pixbuf_new_from_file(source_file, NULL);
 		}
+		if (!pixbuf)
+			return NULL;
 		break;
 	default:
 		g_assert_not_reached();
@@ -479,8 +481,11 @@
 		width = gdk_pixbuf_get_width(pixbuf);
 		height = gdk_pixbuf_get_height(pixbuf);
 	} else {
-		width = cairo_xlib_surface_get_width(bg->root_surface);
-		height = cairo_xlib_surface_get_height(bg->root_surface);
+		if (bg->root_surface) {
+			width = cairo_xlib_surface_get_width(bg->root_surface);
+			height = cairo_xlib_surface_get_height(bg->root_surface);
+		} else
+			return NULL;
 	}
 
 	item->surface =

Reply via email to