diff options
author | Stefan Sauer <ensonic@users.sf.net> | 2013-10-21 09:07:09 +0200 |
---|---|---|
committer | Stefan Sauer <ensonic@users.sf.net> | 2013-10-21 09:07:09 +0200 |
commit | 09600c8fb20a90f8c959284cd1515095d61e0375 (patch) | |
tree | 749accaa7690e8149f83829402ecf996ec3bbfe2 /mediainfo | |
parent | 079745094c51215c8f2cec84fe308077dc855f1b (diff) |
mi-preview: use ensure_native() in realized()
This fixes X crashers at startup when preparing the overlay.
Diffstat (limited to 'mediainfo')
-rw-r--r-- | mediainfo/src/mi-info.vala | 7 | ||||
-rw-r--r-- | mediainfo/src/mi-preview.vala | 7 |
2 files changed, 12 insertions, 2 deletions
diff --git a/mediainfo/src/mi-info.vala b/mediainfo/src/mi-info.vala index a1d4efa..74ec668 100644 --- a/mediainfo/src/mi-info.vala +++ b/mediainfo/src/mi-info.vala @@ -506,9 +506,12 @@ public class MediaInfo.Info : Box } private void on_element_sync_message (Gst.Bus bus, Message message) { - if (Gst.Video.is_video_overlay_prepare_window_handle_message (message)) { + if (Video.is_video_overlay_prepare_window_handle_message (message)) { + Gdk.Window window = preview.get_window (); + debug ("prepare overlay: %p", window); overlay = message.src as Gst.Video.Overlay; - overlay.set_window_handle ((uint *)Gdk.X11Window.get_xid (preview.get_window ())); + overlay.set_window_handle ((uint *)Gdk.X11Window.get_xid (window)); + debug ("prepared overlay"); } } diff --git a/mediainfo/src/mi-preview.vala b/mediainfo/src/mi-preview.vala index 8ceb093..fbc3f29 100644 --- a/mediainfo/src/mi-preview.vala +++ b/mediainfo/src/mi-preview.vala @@ -116,6 +116,13 @@ public class MediaInfo.Preview : DrawingArea { alloc.x, alloc.y, alloc_width, alloc_height); } + public override void realize () { + base.realize(); + debug ("realize"); + if (!get_window ().ensure_native ()) + error ("Couldn't create native window needed for GstVideoOverlay!"); + } + public override bool draw (Cairo.Context cr) { if (content != null) { Gdk.Pixbuf pb = content.scale_simple (alloc_width, alloc_height, Gdk.InterpType.BILINEAR); |