From b01af54b389c9ddf40fe2f33dd57039abb66e22e Mon Sep 17 00:00:00 2001 From: William Hua Date: Mon, 15 Apr 2013 15:52:34 -0400 Subject: Fix segfault. --- lib/main.vala | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'lib') diff --git a/lib/main.vala b/lib/main.vala index 27fae8e7..52f7ab8b 100644 --- a/lib/main.vala +++ b/lib/main.vala @@ -48,8 +48,6 @@ public class Indicator.Keyboard.Service : Object { const int H = 20; const double R = 2.0; - Icon icon = null; - Pango.FontDescription description; var style = get_style_context (); var colour = style.get_color (Gtk.StateFlags.NORMAL); @@ -82,12 +80,14 @@ public class Indicator.Keyboard.Service : Object { Pango.cairo_layout_path (context, layout); context.fill (); + var buffer = new ByteArray (); + surface.write_to_png_stream ((data) => { - icon = new BytesIcon (new Bytes (data)); - return icon != null ? Cairo.Status.SUCCESS : Cairo.Status.NULL_POINTER; + buffer.append (data); + return Cairo.Status.SUCCESS; }); - return icon; + return new BytesIcon (ByteArray.free_to_bytes ((owned) buffer)); } [DBus (visible = false)] -- cgit v1.2.3