[banshee] ProfileComboBoxConfigurable: Prevent exceptions in Combo.StateChanged



commit c144c469b19824a8e0ffed98b841a77849d429c8
Author: Bertrand Lorentz <bertrand lorentz gmail com>
Date:   Sat Jan 4 18:08:02 2014 +0100

    ProfileComboBoxConfigurable: Prevent exceptions in Combo.StateChanged
    
    Before adding or removing the DescriptionLabel from the container, we
    check whether it's already a child of the container or not, so we only
    do the addition or the removal if it's actually needed.
    
    This prevents exceptions when opening the preferences dialog, caused by
    GTK+ assertion failures.

 .../ProfileComboBoxConfigurable.cs                 |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/src/Core/Banshee.ThickClient/Banshee.MediaProfiles.Gui/ProfileComboBoxConfigurable.cs 
b/src/Core/Banshee.ThickClient/Banshee.MediaProfiles.Gui/ProfileComboBoxConfigurable.cs
index 2d0e6e5..72c6f94 100644
--- a/src/Core/Banshee.ThickClient/Banshee.MediaProfiles.Gui/ProfileComboBoxConfigurable.cs
+++ b/src/Core/Banshee.ThickClient/Banshee.MediaProfiles.Gui/ProfileComboBoxConfigurable.cs
@@ -84,9 +84,9 @@ namespace Banshee.MediaProfiles.Gui
             };
 
             Combo.StateChanged += delegate {
-                if (Combo.State == StateType.Insensitive) {
+                if (Combo.State == StateType.Insensitive && description.Parent != null) {
                     ((Container)parent ?? this).Remove (description);
-                } else {
+                } else if (description.Parent == null) {
                     description.PackInto (parent ?? this, parent != null);
                 }
             };


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