[retro-gtk/wip/aplazas/null-core: 1/2] video: Make CairoDisplay.set_core() accept null



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

    video: Make CairoDisplay.set_core() accept null
    
    This will help releasing references on the core.

 retro-gtk/video/cairo-display.vala |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/retro-gtk/video/cairo-display.vala b/retro-gtk/video/cairo-display.vala
index ba1fb6b..eb993e3 100644
--- a/retro-gtk/video/cairo-display.vala
+++ b/retro-gtk/video/cairo-display.vala
@@ -24,12 +24,14 @@ 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) {
+       public void set_core (Core? core) {
                if (this.core != null)
                        this.core.disconnect (on_video_output_id);
 
                this.core = core;
-               on_video_output_id = core.video_output.connect (on_video_output);
+
+               if (this.core != null)
+                       on_video_output_id = 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]