aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam Hua <william.hua@canonical.com>2013-04-15 15:52:34 -0400
committerWilliam Hua <william.hua@canonical.com>2013-04-15 15:52:34 -0400
commitb01af54b389c9ddf40fe2f33dd57039abb66e22e (patch)
tree256f84d040e39c995687824ca5922f132f1d3923
parent84d7f8a86c6dab2ba760f002e656c5d51b98391b (diff)
downloadayatana-indicator-keyboard-b01af54b389c9ddf40fe2f33dd57039abb66e22e.tar.gz
ayatana-indicator-keyboard-b01af54b389c9ddf40fe2f33dd57039abb66e22e.tar.bz2
ayatana-indicator-keyboard-b01af54b389c9ddf40fe2f33dd57039abb66e22e.zip
Fix segfault.
-rw-r--r--lib/main.vala10
1 files changed, 5 insertions, 5 deletions
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)]