[banshee] Dap: avoid NRE when disconnecting Nexus 4 (bgo#722219)



commit 64d9980b598bcc2d31b973344f09d0a8060d661e
Author: Andrés G. Aragoneses <knocte gmail com>
Date:   Wed Jan 15 01:13:38 2014 +0100

    Dap: avoid NRE when disconnecting Nexus 4 (bgo#722219)
    
    The previous commit introduced the possibility for Gtk#
    to create this class via an IntPtr handle, so in this
    case its source field is always null, and therefore we
    need to do a null check when destroying.

 src/Dap/Banshee.Dap/Banshee.Dap.Gui/DapInfoBar.cs |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/src/Dap/Banshee.Dap/Banshee.Dap.Gui/DapInfoBar.cs 
b/src/Dap/Banshee.Dap/Banshee.Dap.Gui/DapInfoBar.cs
index e8df0fd..061c0da 100644
--- a/src/Dap/Banshee.Dap/Banshee.Dap.Gui/DapInfoBar.cs
+++ b/src/Dap/Banshee.Dap/Banshee.Dap.Gui/DapInfoBar.cs
@@ -57,8 +57,10 @@ namespace Banshee.Dap.Gui
         protected override void OnDestroyed ()
         {
             base.OnDestroyed ();
-            source.Updated -= OnSourceUpdated;
-            source = null;
+            if (source != null) {
+                source.Updated -= OnSourceUpdated;
+                source = null;
+            }
         }
 
         private void BuildWidget ()


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