[PATCH] fix terminal crash

twied twied at gmx.net
Wed Jan 19 05:31:46 PST 2011


Hi,

terminal crashed for me randomly on resizing.
Output from compositor: "failed to create image for name 16"
Output from terminal: "sent request to invalid object"

This patch fixes the issue, terminal runs stable here.

---
  clients/terminal.c |   10 ++++++++--
  1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/clients/terminal.c b/clients/terminal.c
index d3d7a0b..e8131d1 100644
--- a/clients/terminal.c
+++ b/clients/terminal.c
@@ -836,13 +836,19 @@ terminal_draw_contents(struct terminal *terminal)
  	union utf8_char *p_row;
  	union decoded_attr attr;
  	int text_x, text_y;
-	cairo_surface_t *surface;
+	cairo_surface_t *wsurface, *surface;
  	double d;
  	struct glyph_run run;

  	window_get_child_allocation(terminal->window, &allocation);

-	surface = display_create_surface(terminal->display, &allocation);
+        wsurface = window_get_surface(terminal->window);
+        surface = cairo_surface_create_similar(wsurface,
+                                               CAIRO_CONTENT_COLOR_ALPHA,
+                                               allocation.width,
+                                               allocation.height);
+        cairo_surface_destroy(wsurface);
+
  	cr = cairo_create(surface);
  	cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE);
  	terminal_set_color(terminal, cr, terminal->color_scheme->border);
-- 
1.7.2.3


More information about the wayland-devel mailing list