Author: lluis
Date: 2007-10-16 02:46:50 -0400 (Tue, 16 Oct 2007)
New Revision: 87556

Modified:
   trunk/stetic/ChangeLog
   trunk/stetic/libstetic/editor/ActionGroupEditor.cs
   trunk/stetic/libstetic/editor/ActionToolbar.cs
   trunk/stetic/libsteticui/ActionGroupDesignerBackend.cs
   trunk/stetic/libsteticui/ActionGroupEditSession.cs
   trunk/stetic/libsteticui/PluggableWidget.cs
   trunk/stetic/libsteticui/WidgetActionBar.cs
   trunk/stetic/libsteticui/WidgetDesignerBackend.cs
   trunk/stetic/libsteticui/WidgetEditSession.cs
Log:
* libsteticui/WidgetEditSession.cs: Removed unneeded dispose and
  destroy calls. The toolbar will be destroyed together with the
  parent.
* libsteticui/ActionGroupEditSession.cs: If the designer has not been
  requested, it means it has not been added to a container, so it has
  to be explicitely destroyed.
* libsteticui/WidgetActionBar.cs: Removed unneeded Dispose and Destroy
  calls (Destroy already calls dispose).
* libsteticui/WidgetDesignerBackend.cs: Make sure base.Dispose is
  always called. Handle exceptions thrown by the GConf query.
* libsteticui/ActionGroupDesignerBackend.cs: Remove references on
  dispose. Helps tracking down leaks.
* libsteticui/PluggableWidget.cs: Don't try to create an image of the
  designer if it is not visible. Don't explicitely destroy the child
  designer. It will be destroyed by the subclass.
* libstetic/editor/ActionToolbar.cs,
  libstetic/editor/ActionGroupEditor.cs: Properly destroy items.

Modified: trunk/stetic/ChangeLog
===================================================================
--- trunk/stetic/ChangeLog      2007-10-16 06:36:10 UTC (rev 87555)
+++ trunk/stetic/ChangeLog      2007-10-16 06:46:50 UTC (rev 87556)
@@ -1,3 +1,22 @@
+2007-10-16  Lluis Sanchez Gual <[EMAIL PROTECTED]> 
+
+       * libsteticui/WidgetEditSession.cs: Removed unneeded dispose and destroy
+         calls. The toolbar will be destroyed together with the parent.
+       * libsteticui/ActionGroupEditSession.cs: If the designer has not been
+         requested, it means it has not been added to a container, so it has to
+         be explicitely destroyed.
+       * libsteticui/WidgetActionBar.cs: Removed unneeded Dispose and Destroy 
calls
+         (Destroy already calls dispose).
+       * libsteticui/WidgetDesignerBackend.cs: Make sure base.Dispose is always
+         called. Handle exceptions thrown by the GConf query.
+       * libsteticui/ActionGroupDesignerBackend.cs: Remove references on 
dispose.
+         Helps tracking down leaks.
+       * libsteticui/PluggableWidget.cs: Don't try to create an image of the
+         designer if it is not visible. Don't explicitely destroy the child
+         designer. It will be destroyed by the subclass.
+       * libstetic/editor/ActionToolbar.cs, 
libstetic/editor/ActionGroupEditor.cs:
+         Properly destroy items.
+
 2007-10-04  Lluis Sanchez Gual <[EMAIL PROTECTED]> 
 
        * libstetic/wrapper/Action.cs: Avoid providing a null name in the 
Gtk.Action

Modified: trunk/stetic/libstetic/editor/ActionGroupEditor.cs
===================================================================
--- trunk/stetic/libstetic/editor/ActionGroupEditor.cs  2007-10-16 06:36:10 UTC 
(rev 87555)
+++ trunk/stetic/libstetic/editor/ActionGroupEditor.cs  2007-10-16 06:46:50 UTC 
(rev 87556)
@@ -64,8 +64,9 @@
                        
                        foreach (ActionMenuItem aitem in items) {
                                aitem.KeyPressEvent -= OnItemKeyPress;
-                               aitem.Dispose ();
                                aitem.Node.Dispose ();
+                               aitem.Detach ();
+                               aitem.Destroy ();
                        }
                        items.Clear ();
                        ActionGroup = null;
@@ -290,6 +291,7 @@
                                item.Detach ();
                                item.Node.Dispose ();
                                items.Remove (item);
+                               item.Destroy ();
                                PlaceAddLabel (actionGroup.Actions.Count);
                                ShowAll ();
                        }

Modified: trunk/stetic/libstetic/editor/ActionToolbar.cs
===================================================================
--- trunk/stetic/libstetic/editor/ActionToolbar.cs      2007-10-16 06:36:10 UTC 
(rev 87555)
+++ trunk/stetic/libstetic/editor/ActionToolbar.cs      2007-10-16 06:46:50 UTC 
(rev 87556)
@@ -133,6 +133,7 @@
                                        AddCreateItemLabel ();
                                } else if (!value && addLabel != null) {
                                        Remove (addLabel);
+                                       addLabel.Destroy ();
                                        addLabel = null;
                                        if (actionTree.Children.Count == 0)
                                                AddSpacerItem ();
@@ -165,6 +166,7 @@
                                if (w is CustomToolbarItem && 
((CustomToolbarItem)w).ActionToolItem.Node == args.Node) {
                                        Remove (w);
                                        toolItems.Remove 
(((CustomToolbarItem)w).ActionToolItem);
+                                       w.Destroy ();
                                        if (!showPlaceholder && toolItems.Count 
== 0)
                                                AddSpacerItem ();
                                        break;
@@ -188,7 +190,6 @@
                                        area.ResetSelection (it.ActionToolItem);
                                }
                                Remove (w);
-                               w.Dispose ();
                                w.Destroy ();
                        }
                        

Modified: trunk/stetic/libsteticui/ActionGroupDesignerBackend.cs
===================================================================
--- trunk/stetic/libsteticui/ActionGroupDesignerBackend.cs      2007-10-16 
06:36:10 UTC (rev 87555)
+++ trunk/stetic/libsteticui/ActionGroupDesignerBackend.cs      2007-10-16 
06:46:50 UTC (rev 87556)
@@ -32,5 +32,14 @@
                {
                        groupDesign.UpdateObjectViewers ();
                }
+               
+               public override void Dispose ()
+               {
+                       this.editor = null;
+                       this.toolbar = null;
+                       this.groupDesign = null;
+                       base.Dispose ();
+               }
+
        }
 }

Modified: trunk/stetic/libsteticui/ActionGroupEditSession.cs
===================================================================
--- trunk/stetic/libsteticui/ActionGroupEditSession.cs  2007-10-16 06:36:10 UTC 
(rev 87555)
+++ trunk/stetic/libsteticui/ActionGroupEditSession.cs  2007-10-16 06:46:50 UTC 
(rev 87556)
@@ -16,6 +16,7 @@
                ProjectBackend project;
                bool modified;
                bool allowActionBinding;
+               bool designerRequested;
                ActionGroupToolbar groupToolbar;
                        
                Stetic.Wrapper.ActionGroup groupCopy;
@@ -237,6 +238,7 @@
                
                public ActionGroupDesignerBackend Backend {
                        get {
+                               designerRequested = true;
                                return designer;
                        }
                }
@@ -276,6 +278,10 @@
                {
                        if (designer != null)
                                designer.Editor.GroupModified -= OnModified;
+                       if (!designerRequested) {
+                               designer.Destroy ();
+                       }
+                       
                        project.ProjectReloaded -= OnProjectReloaded;
                        
                        if (plug != null)

Modified: trunk/stetic/libsteticui/PluggableWidget.cs
===================================================================
--- trunk/stetic/libsteticui/PluggableWidget.cs 2007-10-16 06:36:10 UTC (rev 
87555)
+++ trunk/stetic/libsteticui/PluggableWidget.cs 2007-10-16 06:46:50 UTC (rev 
87556)
@@ -80,7 +80,7 @@
                        if (book.NPages == 1) {
                                Gtk.Widget w = book.GetNthPage (0);
                                Gdk.Window win = w.GdkWindow;
-                               if (win != null) {
+                               if (win != null && win.IsViewable) {
                                        Gdk.Pixbuf img = 
Gdk.Pixbuf.FromDrawable (win, win.Colormap, w.Allocation.X, w.Allocation.Y, 0, 
0, w.Allocation.Width, w.Allocation.Height);
                                        Gtk.Image oldImage = new Gtk.Image 
(img);
                                        oldImage.Show ();
@@ -105,8 +105,8 @@
                                book.Page = book.NPages - 1;
                                if (book.NPages > 1) {
                                        Gtk.Widget cw = book.GetNthPage (0);
-                                       book.RemovePage (0);
-                                       cw.Destroy ();
+                                       book.Remove (cw);
+                                       OnDestroyWidget (cw);
                                }
                        }
                }
@@ -115,6 +115,7 @@
                protected abstract void OnDestroyPlug (uint socketId);
                
                protected abstract Gtk.Widget OnCreateWidget ();
+               protected virtual void OnDestroyWidget (Gtk.Widget w) {}
                
                public override void Dispose ()
                {

Modified: trunk/stetic/libsteticui/WidgetActionBar.cs
===================================================================
--- trunk/stetic/libsteticui/WidgetActionBar.cs 2007-10-16 06:36:10 UTC (rev 
87555)
+++ trunk/stetic/libsteticui/WidgetActionBar.cs 2007-10-16 06:46:50 UTC (rev 
87556)
@@ -50,9 +50,6 @@
                {
                        RootWidget = null;
                        Clear ();
-                       combo.Dispose ();
-                       combo.Destroy ();
-                       combo = null;
                        base.Dispose ();
                }
                
@@ -101,7 +98,6 @@
                                if (child != comboItem) {
                                        Remove (child);
                                        child.Destroy ();
-                                       child.Dispose ();
                                }
                }
                

Modified: trunk/stetic/libsteticui/WidgetDesignerBackend.cs
===================================================================
--- trunk/stetic/libsteticui/WidgetDesignerBackend.cs   2007-10-16 06:36:10 UTC 
(rev 87555)
+++ trunk/stetic/libsteticui/WidgetDesignerBackend.cs   2007-10-16 06:46:50 UTC 
(rev 87556)
@@ -111,8 +111,6 @@
                        }
                        
                        resizableFixed.Put (preview, container);
-               //      Gtk.Fixed realFixed = new Gtk.Fixed ();
-               //      realFixed.Put (fixd, 0, 0);
 
                        if (designWidth != -1) {
                                preview.WidthRequest = designWidth;
@@ -134,16 +132,16 @@
                
                public override void Dispose ()
                {
-                       if (preview == null)
-                               return;
-                       if (wrapper != null)
-                               wrapper.DetachDesigner (resizableFixed);
-                       preview.SizeAllocated -= new Gtk.SizeAllocatedHandler 
(OnResized);
-                       resizableFixed.SelectionChanged -= OnSelectionChanged;
-                       resizableFixed.Dispose ();
-                       resizableFixed = null;
-                       preview = null;
-                       wrapper = null;
+                       if (preview != null) {
+                               if (wrapper != null)
+                                       wrapper.DetachDesigner (resizableFixed);
+                               preview.SizeAllocated -= new 
Gtk.SizeAllocatedHandler (OnResized);
+                               resizableFixed.SelectionChanged -= 
OnSelectionChanged;
+//                             resizableFixed.Destroy ();
+                               resizableFixed = null;
+                               preview = null;
+                               wrapper = null;
+                       }
                        base.Dispose ();
                }
                
@@ -215,10 +213,10 @@
                static Metacity.Theme GetTheme ()
                {
                        if (theme == null) {
-                               GConf.Client client = new GConf.Client ();
-//                             client.AddNotify ("/apps/metacity/general", 
GConfNotify);
-                               string themeName = (string)client.Get 
("/apps/metacity/general/theme");
                                try {
+                                       GConf.Client client = new GConf.Client 
();
+                                       // client.AddNotify 
("/apps/metacity/general", GConfNotify);
+                                       string themeName = (string)client.Get 
("/apps/metacity/general/theme");
                                        theme = Metacity.Theme.Load (themeName);
                                } catch {
                                        // Don't crash if metacity is not 
available

Modified: trunk/stetic/libsteticui/WidgetEditSession.cs
===================================================================
--- trunk/stetic/libsteticui/WidgetEditSession.cs       2007-10-16 06:36:10 UTC 
(rev 87555)
+++ trunk/stetic/libsteticui/WidgetEditSession.cs       2007-10-16 06:46:50 UTC 
(rev 87556)
@@ -187,9 +187,6 @@
                
                public void Dispose ()
                {
-                       if (toolbar != null)
-                               toolbar.Destroy ();
-                       
                        sourceProject.ComponentTypesChanged -= 
OnSourceProjectLibsChanged;
                        sourceProject.ProjectReloaded -= 
OnSourceProjectReloaded;
                        
@@ -294,7 +291,7 @@
                                rootWidget = Stetic.Wrapper.Container.Lookup 
(tops[0]);
                                undoManager.RootObject = rootWidget;
                                if (rootWidget != null) {
-                                       WidgetDesignerBackend oldWidget = 
widget;
+                                       Gtk.Widget oldWidget = designer;
                                        if (widget != null) {
                                                widget.SelectionChanged -= 
OnSelectionChanged;
                                                widget = null;
@@ -334,7 +331,6 @@
                        if (designer != null) {
                                if (designer.Parent is Gtk.Plug)
                                        ((Gtk.Plug)designer.Parent).Remove 
(designer);
-                               designer.Dispose ();
                                designer = null;
                        }
                        

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

Reply via email to