Author: lluis
Date: 2006-08-29 07:36:36 -0400 (Tue, 29 Aug 2006)
New Revision: 64507

Modified:
   trunk/stetic/ChangeLog
   trunk/stetic/libstetic/ObjectWrapper.cs
   trunk/stetic/libstetic/editor/ActionGroupEditor.cs
   trunk/stetic/libstetic/editor/ActionMenu.cs
   trunk/stetic/libstetic/editor/ActionMenuBar.cs
   trunk/stetic/libsteticui/ActionGroupDesigner.cs
   trunk/stetic/libsteticui/ActionGroupToolbar.cs
   trunk/stetic/libsteticui/Palette.cs
   trunk/stetic/libsteticui/Project.cs
   trunk/stetic/libsteticui/WidgetActionBar.cs
   trunk/stetic/libsteticui/WidgetDesigner.cs
   trunk/stetic/stetic/DesignerView.cs
   trunk/stetic/stetic/Stetic.cs
Log:
2006-08-29  Lluis Sanchez Gual  <[EMAIL PROTECTED]>

        * libsteticui/ActionGroupDesigner.cs:
        * libsteticui/ActionGroupToolbar.cs:
        * libsteticui/Palette.cs:
        * libsteticui/WidgetDesigner.cs:
        * libsteticui/Project.cs: 
        * libsteticui/WidgetActionBar.cs:
        * libstetic/ObjectWrapper.cs:
        * libstetic/editor/ActionMenuBar.cs:
        * libstetic/editor/ActionMenu.cs:
        * libstetic/editor/ActionGroupEditor.cs:
        * stetic/Stetic.cs: Explicitely destroy custom widgets to avoid memory
          leaks.



Modified: trunk/stetic/ChangeLog
===================================================================
--- trunk/stetic/ChangeLog      2006-08-29 07:28:18 UTC (rev 64506)
+++ trunk/stetic/ChangeLog      2006-08-29 11:36:36 UTC (rev 64507)
@@ -1,3 +1,18 @@
+2006-08-29  Lluis Sanchez Gual  <[EMAIL PROTECTED]>
+
+       * libsteticui/ActionGroupDesigner.cs:
+       * libsteticui/ActionGroupToolbar.cs:
+       * libsteticui/Palette.cs:
+       * libsteticui/WidgetDesigner.cs:
+       * libsteticui/Project.cs: 
+       * libsteticui/WidgetActionBar.cs:
+       * libstetic/ObjectWrapper.cs:
+       * libstetic/editor/ActionMenuBar.cs:
+       * libstetic/editor/ActionMenu.cs:
+       * libstetic/editor/ActionGroupEditor.cs:
+       * stetic/Stetic.cs: Explicitely destroy custom widgets to avoid memory
+         leaks.
+
 2006-08-26  Lluis Sanchez Gual  <[EMAIL PROTECTED]>
 
        * libstetic/wrapper/WidgetEventHandler.cs: Added WidgetWrapper property.

Modified: trunk/stetic/libstetic/ObjectWrapper.cs
===================================================================
--- trunk/stetic/libstetic/ObjectWrapper.cs     2006-08-29 07:28:18 UTC (rev 
64506)
+++ trunk/stetic/libstetic/ObjectWrapper.cs     2006-08-29 11:36:36 UTC (rev 
64507)
@@ -55,6 +55,8 @@
                public virtual void Dispose ()
                {
                        wrappers.Remove (GetIndentityObject (wrapped));
+                       proj = null;
+                       signals = null;
                }
 
                public static ObjectWrapper Create (IProject proj, object 
wrapped)

Modified: trunk/stetic/libstetic/editor/ActionGroupEditor.cs
===================================================================
--- trunk/stetic/libstetic/editor/ActionGroupEditor.cs  2006-08-29 07:28:18 UTC 
(rev 64506)
+++ trunk/stetic/libstetic/editor/ActionGroupEditor.cs  2006-08-29 11:36:36 UTC 
(rev 64507)
@@ -56,6 +56,26 @@
                        ShowAll ();
                }
                
+               public override void Dispose ()
+               {
+                       foreach (ActionMenuItem aitem in items) {
+                               aitem.KeyPressEvent -= OnItemKeyPress;
+                               aitem.Dispose ();
+                               aitem.Node.Dispose ();
+                       }
+                       items.Clear ();
+                       ActionGroup = null;
+                       project = null;
+                       headerLabel = null;
+                       
+                       if (darea != null) {
+                               darea.SelectionChanged -= OnSelectionChanged;
+                               darea = null;
+                       }
+
+                       base.Dispose ();
+               }
+               
                public ActionGroup ActionGroup {
                        get { return actionGroup; }
                        set {

Modified: trunk/stetic/libstetic/editor/ActionMenu.cs
===================================================================
--- trunk/stetic/libstetic/editor/ActionMenu.cs 2006-08-29 07:28:18 UTC (rev 
64506)
+++ trunk/stetic/libstetic/editor/ActionMenu.cs 2006-08-29 11:36:36 UTC (rev 
64507)
@@ -52,6 +52,7 @@
                        base.Dispose ();
                        parentNode.ChildNodeAdded -= OnChildAdded;
                        parentNode.ChildNodeRemoved -= OnChildRemoved;
+                       parentNode = null;
                }
                
                public void Select (ActionTreeNode node)

Modified: trunk/stetic/libstetic/editor/ActionMenuBar.cs
===================================================================
--- trunk/stetic/libstetic/editor/ActionMenuBar.cs      2006-08-29 07:28:18 UTC 
(rev 64506)
+++ trunk/stetic/libstetic/editor/ActionMenuBar.cs      2006-08-29 11:36:36 UTC 
(rev 64507)
@@ -47,6 +47,7 @@
                        
                        foreach (Gtk.Widget w in Children) {
                                Remove (w);
+                               w.Destroy ();
                                w.Dispose ();
                        }
 

Modified: trunk/stetic/libsteticui/ActionGroupDesigner.cs
===================================================================
--- trunk/stetic/libsteticui/ActionGroupDesigner.cs     2006-08-29 07:28:18 UTC 
(rev 64506)
+++ trunk/stetic/libsteticui/ActionGroupDesigner.cs     2006-08-29 11:36:36 UTC 
(rev 64507)
@@ -35,9 +35,12 @@
                
                public override void Dispose ()
                {
-                       editor.Dispose ();
-                       toolbar.Dispose ();
-                       groupDesign.Dispose ();
+                       editor.Destroy ();
+                       toolbar.Destroy ();
+                       groupDesign.Destroy ();
+                       editor = null;
+                       toolbar = null;
+                       groupDesign = null;
                }
        }
 }

Modified: trunk/stetic/libsteticui/ActionGroupToolbar.cs
===================================================================
--- trunk/stetic/libsteticui/ActionGroupToolbar.cs      2006-08-29 07:28:18 UTC 
(rev 64506)
+++ trunk/stetic/libsteticui/ActionGroupToolbar.cs      2006-08-29 11:36:36 UTC 
(rev 64507)
@@ -209,8 +209,10 @@
                void UpdateActionCommands (Action action)
                {
                        foreach (Gtk.Widget w in Children) {
-                               if (!internalButtons.Contains (w))
+                               if (!internalButtons.Contains (w)) {
                                        Remove (w);
+                                       w.Destroy ();
+                               }
                        }
                        AddActionCommands (action);
                                

Modified: trunk/stetic/libsteticui/Palette.cs
===================================================================
--- trunk/stetic/libsteticui/Palette.cs 2006-08-29 07:28:18 UTC (rev 64506)
+++ trunk/stetic/libsteticui/Palette.cs 2006-08-29 11:36:36 UTC (rev 64507)
@@ -32,6 +32,21 @@
                public override void Dispose ()
                {
                        Registry.RegistryChanged -= OnRegistryChanged;
+                       
+                       foreach (PaletteGroup grp in groups.Values)
+                               grp.Destroy ();
+
+                       if (localActionsBox != null) {
+                               localActionsBox.Destroy ();
+                               localActionsBox = null;
+                       }
+                       if (globalActionsBox != null) {
+                               globalActionsBox.Destroy ();
+                               globalActionsBox = null;
+                       }
+                       
+                       project = null;
+                       selection = null;
                        base.Dispose ();
                }
                
@@ -93,8 +108,10 @@
                
                public void LoadWidgets (Project project)
                {
-                       foreach (PaletteGroup g in groups.Values)
+                       foreach (PaletteGroup g in groups.Values) {
                                Remove (g);
+                               g.Destroy ();
+                       }
                                
                        groups.Clear ();
                        
@@ -131,9 +148,9 @@
                        }
 
                        if (localActionsBox != null)
-                               localActionsBox.Dispose ();
+                               localActionsBox.Destroy ();
                        if (globalActionsBox != null)
-                               globalActionsBox.Dispose ();
+                               globalActionsBox.Destroy ();
                                
                        PaletteGroup widgetGroup = AddOrGetGroup ("actions", 
Catalog.GetString ("Actions"));
                        localActionsBox = new ActionGroupBox ();
@@ -217,8 +234,10 @@
        
                public void Clear ()
                {
-                       foreach (Gtk.Widget w in vbox.Children)
+                       foreach (Gtk.Widget w in vbox.Children) {
                                vbox.Remove (w);
+                               w.Destroy ();
+                       }
 
                        isEmpty = true;
                        vbox.PackStart (emptyLabel, false, false, 0);
@@ -317,6 +336,8 @@
                public override void Dispose ()
                {
                        base.Dispose ();
+                       foreach (ActionPaletteGroup grp in Children)
+                               grp.Destroy ();
                        SetActionGroups (null);
                }
                
@@ -324,7 +345,7 @@
                {
                        foreach (ActionPaletteGroup grp in Children) {
                                Remove (grp);
-                               grp.Dispose ();
+                               grp.Destroy ();
                        }
                        
                        if (groups != null) {
@@ -348,7 +369,7 @@
                        foreach (ActionPaletteGroup grp in Children) {
                                if (grp.Group == args.ActionGroup) {
                                        Remove (grp);
-                                       grp.Dispose ();
+                                       grp.Destroy ();
                                }
                        }
                }

Modified: trunk/stetic/libsteticui/Project.cs
===================================================================
--- trunk/stetic/libsteticui/Project.cs 2006-08-29 07:28:18 UTC (rev 64506)
+++ trunk/stetic/libsteticui/Project.cs 2006-08-29 11:36:36 UTC (rev 64507)
@@ -55,6 +55,9 @@
                        Registry.RegistryChanging -= OnRegistryChanging;
                        Registry.RegistryChanged -= OnRegistryChanged;
                        Close ();
+                       store.Dispose ();
+                       iconFactory = null;
+                       ActionGroups = null;
                }
                
                public string FileName {

Modified: trunk/stetic/libsteticui/WidgetActionBar.cs
===================================================================
--- trunk/stetic/libsteticui/WidgetActionBar.cs 2006-08-29 07:28:18 UTC (rev 
64506)
+++ trunk/stetic/libsteticui/WidgetActionBar.cs 2006-08-29 11:36:36 UTC (rev 
64507)
@@ -43,7 +43,11 @@
                
                public override void Dispose ()
                {
+                       RootWidget = null;
                        Clear ();
+                       combo.Dispose ();
+                       combo.Destroy ();
+                       combo = null;
                        base.Dispose ();
                }
                
@@ -83,8 +87,11 @@
                        toggles.Clear ();
                                
                        foreach (Gtk.Widget child in Children)
-                               if (child != comboItem)
+                               if (child != comboItem) {
                                        Remove (child);
+                                       child.Destroy ();
+                                       child.Dispose ();
+                               }
                }
                
                void OnSelectionChanged (object s, Wrapper.WidgetEventArgs args)

Modified: trunk/stetic/libsteticui/WidgetDesigner.cs
===================================================================
--- trunk/stetic/libsteticui/WidgetDesigner.cs  2006-08-29 07:28:18 UTC (rev 
64506)
+++ trunk/stetic/libsteticui/WidgetDesigner.cs  2006-08-29 11:36:36 UTC (rev 
64507)
@@ -135,6 +135,12 @@
                {
                        if (wrapper != null)
                                wrapper.DetachDesigner (resizableFixed);
+                       preview.SizeAllocated -= new Gtk.SizeAllocatedHandler 
(OnResized);
+                       resizableFixed.Dispose ();
+                       resizableFixed.Destroy ();
+                       resizableFixed = null;
+                       preview = null;
+                       wrapper = null;
                        base.Dispose ();
                }
                
@@ -330,6 +336,13 @@
                        child.SizeRequested += new SizeRequestedHandler 
(OnSizeReq);
                }
                
+               public override void Dispose ()
+               {
+                       if (child != null)
+                               child.SizeRequested -= new SizeRequestedHandler 
(OnSizeReq);
+                       base.Dispose ();
+               }
+               
                public bool IsSelected (Gtk.Widget widget)
                {
                        return selectionWidget == widget;
@@ -576,7 +589,8 @@
                        base.ForAll (include_internals, callback);
                        foreach (TopLevelChild child in topLevels)
                                callback (child.Child);
-                       selectionBox.ForAll (include_internals, callback);
+                       if (include_internals)
+                               selectionBox.ForAll (include_internals, 
callback);
                }
                
                protected override bool OnMotionNotifyEvent (Gdk.EventMotion ev)

Modified: trunk/stetic/stetic/DesignerView.cs
===================================================================
--- trunk/stetic/stetic/DesignerView.cs 2006-08-29 07:28:18 UTC (rev 64506)
+++ trunk/stetic/stetic/DesignerView.cs 2006-08-29 11:36:36 UTC (rev 64507)
@@ -32,11 +32,5 @@
                        AppendPage (actionbox, new Gtk.Label (Catalog.GetString 
("Actions")));
                        TabPos = Gtk.PositionType.Bottom;
                }
-               
-               public override void Dispose ()
-               {
-                       design.Dispose ();
-                       actionbox.Dispose ();
-               }
        }
 }

Modified: trunk/stetic/stetic/Stetic.cs
===================================================================
--- trunk/stetic/stetic/Stetic.cs       2006-08-29 07:28:18 UTC (rev 64506)
+++ trunk/stetic/stetic/Stetic.cs       2006-08-29 11:36:36 UTC (rev 64507)
@@ -353,9 +353,11 @@
                                }
                        }
                        
-                       foreach (Gtk.Widget page in openWindows.Values) {
+                       object[] obs = new object [openWindows.Count];
+                       openWindows.Values.CopyTo (obs, 0);
+                       foreach (Gtk.Widget page in obs) {
                                WidgetNotebook.Remove (page);
-                               page.Dispose ();
+                               page.Destroy ();
                        }
                                
                        openWindows.Clear ();
@@ -368,6 +370,7 @@
                public static void Quit ()
                {
                        SaveConfiguration ();
+                       Palette.Destroy ();
                        Program.Quit ();
                }
                

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to