[retro-gtk/wip/aplazas/cairo-no-core] cairo: Accept no core



commit b2a162658e101dc214f7b230e1a9a3d38b2ccd31
Author: Adrien Plazas <kekun plazas laposte net>
Date:   Thu May 18 09:46:54 2017 +0200

    cairo: Accept no core

 retro-gtk/video/cairo-display.vala |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)
---
diff --git a/retro-gtk/video/cairo-display.vala b/retro-gtk/video/cairo-display.vala
index ba1fb6b..c2d0899 100644
--- a/retro-gtk/video/cairo-display.vala
+++ b/retro-gtk/video/cairo-display.vala
@@ -9,7 +9,7 @@ public class Retro.CairoDisplay : Gtk.DrawingArea {
 
        private Core core;
        private VideoFilter filter;
-       private ulong on_video_output_id;
+       private long on_video_output_id;
        private float aspect_ratio;
        private bool show_surface;
 
@@ -24,12 +24,16 @@ public class Retro.CairoDisplay : Gtk.DrawingArea {
        [CCode (cname = "gdk_pixbuf_new_from_video")]
        static extern Gdk.Pixbuf gdk_pixbuf_new_from_video ([CCode (array_length = false)] uint8[] data, uint 
width, uint height, size_t pitch, PixelFormat pixel_format);
 
-       public void set_core (Core core) {
-               if (this.core != null)
-                       this.core.disconnect (on_video_output_id);
+       public void set_core (Core? core) {
+               if (this.core != null) {
+                       this.core.disconnect ((uint) on_video_output_id);
+                       on_video_output_id = -1;
+               }
 
                this.core = core;
-               on_video_output_id = core.video_output.connect (on_video_output);
+
+               if (this.core != null)
+                       on_video_output_id = (long) core.video_output.connect (on_video_output);
        }
 
        public void set_filter (VideoFilter filter) {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]