[retro-gtk/wip/aplazas/null-core: 2/2] audio: Make PaPlayer.set_core() accept null



commit 7c4deb191d2d720f22933e5ae440abfd5ad06504
Author: Adrien Plazas <kekun plazas laposte net>
Date:   Thu May 18 13:18:53 2017 +0200

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

 retro-gtk/audio/pa-player.vala |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/retro-gtk/audio/pa-player.vala b/retro-gtk/audio/pa-player.vala
index 6f5615a..970c49d 100644
--- a/retro-gtk/audio/pa-player.vala
+++ b/retro-gtk/audio/pa-player.vala
@@ -6,12 +6,15 @@ public class Retro.PaPlayer : GLib.Object {
        private double sample_rate;
        private PulseAudio.Simple simple;
 
-       public void set_core (Core core) {
+       public void set_core (Core? core) {
                if (this.core != null)
                        this.core.disconnect (on_audio_output_id);
 
                this.core = core;
-               on_audio_output_id = core.audio_output.connect (on_audio_output);
+
+               if (this.core != null)
+                       on_audio_output_id = core.audio_output.connect (on_audio_output);
+
                simple = null;
        }
 


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