Author: lluis
Date: 2007-02-19 08:37:43 -0500 (Mon, 19 Feb 2007)
New Revision: 73116
Modified:
trunk/stetic/ChangeLog
trunk/stetic/libstetic/editor/ActionGroupEditor.cs
trunk/stetic/libstetic/libstetic.mdp
trunk/stetic/libstetic/undo/UndoManager.cs
trunk/stetic/libstetic/wrapper/ActionTree.cs
trunk/stetic/libstetic/wrapper/Container.cs
trunk/stetic/libstetic/wrapper/MenuBar.cs
trunk/stetic/libstetic/wrapper/Widget.cs
trunk/stetic/libsteticui/ActionGroupDesignerBackend.cs
trunk/stetic/libsteticui/ActionGroupEditSession.cs
trunk/stetic/libsteticui/ActionGroupToolbar.cs
trunk/stetic/libsteticui/PluggableWidget.cs
trunk/stetic/libsteticui/WidgetDesigner.cs
trunk/stetic/libsteticui/WidgetEditSession.cs
trunk/stetic/libsteticui/WidgetFactory.cs
trunk/stetic/libsteticui/libsteticui.mdp
trunk/stetic/stetic/stetic.mdp
Log:
* libsteticui/WidgetFactory.cs, libsteticui/WidgetEditSession.cs:
Several fixes in the disposing code.
* libsteticui/ActionGroupToolbar.cs: Unsubscribe all events, since gtk#
seems to leak if not done. Replaced all anonymous methods, since
keep to many references in memory.
* libsteticui/ActionGroupDesignerBackend.cs: Removed the Dispose
method, since everything will be disposed when the backend is
destroyed.
* libsteticui/libsteticui.mdp, libstetic/libstetic.mdp,
stetic/stetic.mdp: Updated.
* libsteticui/WidgetDesigner.cs: Added some checks to avoid operating
on disposed designers.
* libsteticui/ActionGroupEditSession.cs: Delay the creation of the
action group designer until it is really required.
* libsteticui/PluggableWidget.cs: Explicitely destroy replaced
children.
* libstetic/undo/UndoManager.cs: Don't use an anonymous method since it
will hold a reference to the object to which the event is being
added, and we don't want this.
* libstetic/wrapper/Container.cs, libstetic/wrapper/Widget.cs: Moved
tooltip generation code from Widget to Container. Reset the
generated widget code when starting code generation.
* libstetic/wrapper/MenuBar.cs: Dispose the attached ActionTreeNode
object when the palette item is disposed.
* libstetic/wrapper/ActionTree.cs: Recursively dispose node children.
* libstetic/editor/ActionGroupEditor.cs: Unsubscribe events when
disposing.
Modified: trunk/stetic/ChangeLog
===================================================================
--- trunk/stetic/ChangeLog 2007-02-19 13:30:43 UTC (rev 73115)
+++ trunk/stetic/ChangeLog 2007-02-19 13:37:43 UTC (rev 73116)
@@ -1,3 +1,33 @@
+2007-02-19 Lluis Sanchez Gual <[EMAIL PROTECTED]>
+
+ * libsteticui/WidgetFactory.cs, libsteticui/WidgetEditSession.cs:
+ Several fixes in the disposing code.
+ * libsteticui/ActionGroupToolbar.cs: Unsubscribe all events, since gtk#
+ seems to leak if not done. Replaced all anonymous methods, since
+ keep to many references in memory.
+ * libsteticui/ActionGroupDesignerBackend.cs: Removed the Dispose
+ method, since everything will be disposed when the backend is
+ destroyed.
+ * libsteticui/libsteticui.mdp, libstetic/libstetic.mdp,
+ stetic/stetic.mdp: Updated.
+ * libsteticui/WidgetDesigner.cs: Added some checks to avoid operating
+ on disposed designers.
+ * libsteticui/ActionGroupEditSession.cs: Delay the creation of the
+ action group designer until it is really required.
+ * libsteticui/PluggableWidget.cs: Explicitely destroy replaced
+ children.
+ * libstetic/undo/UndoManager.cs: Don't use an anonymous method since it
+ will hold a reference to the object to which the event is being
+ added, and we don't want this.
+ * libstetic/wrapper/Container.cs, libstetic/wrapper/Widget.cs: Moved
+ tooltip generation code from Widget to Container. Reset the
+ generated widget code when starting code generation.
+ * libstetic/wrapper/MenuBar.cs: Dispose the attached ActionTreeNode
+ object when the palette item is disposed.
+ * libstetic/wrapper/ActionTree.cs: Recursively dispose node children.
+ * libstetic/editor/ActionGroupEditor.cs: Unsubscribe events when
+ disposing.
+
2007-02-13 Lluis Sanchez Gual <[EMAIL PROTECTED]>
* libstetic/wrapper/Container.cs: Emit the content changed event when a
Modified: trunk/stetic/libstetic/editor/ActionGroupEditor.cs
===================================================================
--- trunk/stetic/libstetic/editor/ActionGroupEditor.cs 2007-02-19 13:30:43 UTC
(rev 73115)
+++ trunk/stetic/libstetic/editor/ActionGroupEditor.cs 2007-02-19 13:37:43 UTC
(rev 73116)
@@ -58,6 +58,10 @@
public override void Dispose ()
{
+ headerLabel.Changed -= OnGroupNameChanged;
+ if (emptyLabel != null)
+ emptyLabel.ButtonPressEvent -= OnAddClicked;
+
foreach (ActionMenuItem aitem in items) {
aitem.KeyPressEvent -= OnItemKeyPress;
aitem.Dispose ();
@@ -83,6 +87,8 @@
actionGroup.ObjectChanged -=
OnGroupChanged;
actionGroup.ActionAdded -=
OnActionAdded;
actionGroup.ActionRemoved -=
OnActionRemoved;
+ foreach (Action a in
actionGroup.Actions)
+ a.ObjectChanged -= changedEvent;
}
actionGroup = value;
if (actionGroup != null) {
@@ -222,8 +228,10 @@
void HideAddLabel ()
{
- if (emptyLabel != null)
+ if (emptyLabel != null) {
table.Remove (emptyLabel);
+ emptyLabel.ButtonPressEvent -= OnAddClicked;
+ }
emptyLabel = null;
}
Modified: trunk/stetic/libstetic/libstetic.mdp
===================================================================
--- trunk/stetic/libstetic/libstetic.mdp 2007-02-19 13:30:43 UTC (rev
73115)
+++ trunk/stetic/libstetic/libstetic.mdp 2007-02-19 13:37:43 UTC (rev
73116)
@@ -254,7 +254,7 @@
<ProjectReference type="Gac" localcopy="True" refto="gdk-sharp,
Version=2.4.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
<ProjectReference type="Gac" localcopy="True" refto="System,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</References>
- <MonoDevelop.Autotools.MakefileInfo IntegrationEnabled="True"
RelativeMakefileName="./Makefile.am" ExecuteTargetName="" SyncReferences="True"
IsAutotoolsProject="True" RelativeConfigureInPath="../" OutputDirVar=""
AssemblyNameVar="">
+ <MonoDevelop.Autotools.MakefileInfo IntegrationEnabled="True"
RelativeMakefileName="./Makefile.am" SyncReferences="True"
IsAutotoolsProject="True" RelativeConfigureInPath="../">
<BuildFilesVar Sync="True" Name="libstetic_dll_sources" />
<DeployFilesVar Sync="True" Name="libstetic_dll_datafiles" />
<ResourcesVar Sync="True" Name="libstetic_dll_resources" />
Modified: trunk/stetic/libstetic/undo/UndoManager.cs
===================================================================
--- trunk/stetic/libstetic/undo/UndoManager.cs 2007-02-19 13:30:43 UTC (rev
73115)
+++ trunk/stetic/libstetic/undo/UndoManager.cs 2007-02-19 13:37:43 UTC (rev
73116)
@@ -73,11 +73,16 @@
elements [w] = GetLocalElement (status);
- w.Disposed += delegate {
- UnregisterObject (w);
- };
+ w.Disposed += OnObjectDisposed;
}
+ void OnObjectDisposed (object s, EventArgs a)
+ {
+ ObjectWrapper w = (ObjectWrapper) s;
+ UnregisterObject (w);
+ w.Disposed -= OnObjectDisposed;
+ }
+
// This method can be called to update the xml tree, for
example when a change in the
// object is detected.
internal void UpdateObjectStatus (ObjectWrapper w, XmlElement
status)
Modified: trunk/stetic/libstetic/wrapper/ActionTree.cs
===================================================================
--- trunk/stetic/libstetic/wrapper/ActionTree.cs 2007-02-19 13:30:43 UTC
(rev 73115)
+++ trunk/stetic/libstetic/wrapper/ActionTree.cs 2007-02-19 13:37:43 UTC
(rev 73116)
@@ -82,6 +82,9 @@
action.Deleted -= OnActionDeleted;
action.ObjectChanged -= OnActionChanged;
}
+ if (children != null)
+ foreach (ActionTreeNode node in children)
+ node.Dispose ();
}
void OnActionDeleted (object s, EventArgs args)
Modified: trunk/stetic/libstetic/wrapper/Container.cs
===================================================================
--- trunk/stetic/libstetic/wrapper/Container.cs 2007-02-19 13:30:43 UTC (rev
73115)
+++ trunk/stetic/libstetic/wrapper/Container.cs 2007-02-19 13:37:43 UTC (rev
73116)
@@ -14,6 +14,8 @@
int designWidth;
int designHeight;
IDesignArea designer;
+ CodeExpression generatedTooltips;
+
static DiffGenerator containerDiffGenerator;
static bool showNonContainerWarning = true;
@@ -468,6 +470,8 @@
internal protected override void GenerateBuildCode
(GeneratorContext ctx, CodeExpression var)
{
+ generatedTooltips = null;
+
base.GenerateBuildCode (ctx, var);
if (ClassDescriptor.AllowChildren) {
@@ -604,6 +608,28 @@
}
}
+ internal void GenerateTooltip (GeneratorContext ctx, Widget
widget)
+ {
+ if (generatedTooltips == null) {
+ string tid = ctx.NewId ();
+ CodeVariableDeclarationStatement vardec = new
CodeVariableDeclarationStatement (
+ typeof(Gtk.Tooltips),
+ tid,
+ new CodeObjectCreateExpression
(typeof(Gtk.Tooltips))
+ );
+ ctx.Statements.Add (vardec);
+ generatedTooltips = new
CodeVariableReferenceExpression (tid);
+ }
+ ctx.Statements.Add (
+ new CodeMethodInvokeExpression (
+ generatedTooltips,
+ "SetTip",
+ ctx.WidgetMap.GetWidgetExp (widget),
+ new CodePrimitiveExpression
(widget.Tooltip),
+ new CodePrimitiveExpression
(widget.Tooltip)
+ )
+ );
+ }
internal protected override void OnDesignerAttach (IDesignArea
designer)
{
Modified: trunk/stetic/libstetic/wrapper/MenuBar.cs
===================================================================
--- trunk/stetic/libstetic/wrapper/MenuBar.cs 2007-02-19 13:30:43 UTC (rev
73115)
+++ trunk/stetic/libstetic/wrapper/MenuBar.cs 2007-02-19 13:37:43 UTC (rev
73116)
@@ -219,10 +219,12 @@
public class ActionPaletteItem: Gtk.HBox
{
ActionTreeNode node;
+ bool disposeNode;
public ActionPaletteItem (Gtk.UIManagerItemType type, string
name, Action action)
: this (new ActionTreeNode (type, name, action))
{
+ disposeNode = true;
}
public ActionPaletteItem (ActionTreeNode node)
@@ -246,5 +248,13 @@
public ActionTreeNode Node {
get { return node; }
}
+
+ public override void Dispose ()
+ {
+ base.Dispose ();
+ if (disposeNode)
+ node.Dispose ();
+ }
+
}
}
Modified: trunk/stetic/libstetic/wrapper/Widget.cs
===================================================================
--- trunk/stetic/libstetic/wrapper/Widget.cs 2007-02-19 13:30:43 UTC (rev
73115)
+++ trunk/stetic/libstetic/wrapper/Widget.cs 2007-02-19 13:37:43 UTC (rev
73116)
@@ -21,7 +21,6 @@
ActionGroupCollection actionGroups;
string member;
string tooltip;
- CodeExpression generatedTooltips;
bool requiresUndoStatusUpdate;
@@ -639,29 +638,6 @@
}
return null;
}
-
- void GenerateTooltip (GeneratorContext ctx, Widget widget)
- {
- if (generatedTooltips == null) {
- string tid = ctx.NewId ();
- CodeVariableDeclarationStatement vardec = new
CodeVariableDeclarationStatement (
- typeof(Gtk.Tooltips),
- tid,
- new CodeObjectCreateExpression
(typeof(Gtk.Tooltips))
- );
- ctx.Statements.Add (vardec);
- generatedTooltips = new
CodeVariableReferenceExpression (tid);
- }
- ctx.Statements.Add (
- new CodeMethodInvokeExpression (
- generatedTooltips,
- "SetTip",
- ctx.WidgetMap.GetWidgetExp (widget),
- new CodePrimitiveExpression
(widget.Tooltip),
- new CodePrimitiveExpression
(widget.Tooltip)
- )
- );
- }
public static new Widget Lookup (GLib.Object obj)
{
Modified: trunk/stetic/libsteticui/ActionGroupDesignerBackend.cs
===================================================================
--- trunk/stetic/libsteticui/ActionGroupDesignerBackend.cs 2007-02-19
13:30:43 UTC (rev 73115)
+++ trunk/stetic/libsteticui/ActionGroupDesignerBackend.cs 2007-02-19
13:37:43 UTC (rev 73116)
@@ -32,15 +32,5 @@
{
groupDesign.UpdateObjectViewers ();
}
-
- public override void Dispose ()
- {
- editor.Dispose ();
- toolbar.Dispose ();
- groupDesign.Dispose ();
- editor = null;
- toolbar = null;
- groupDesign = null;
- }
}
}
Modified: trunk/stetic/libsteticui/ActionGroupEditSession.cs
===================================================================
--- trunk/stetic/libsteticui/ActionGroupEditSession.cs 2007-02-19 13:30:43 UTC
(rev 73115)
+++ trunk/stetic/libsteticui/ActionGroupEditSession.cs 2007-02-19 13:37:43 UTC
(rev 73116)
@@ -15,6 +15,7 @@
string containerName;
ProjectBackend project;
bool modified;
+ bool allowActionBinding;
ActionGroupToolbar groupToolbar;
Stetic.Wrapper.ActionGroup groupCopy;
@@ -37,8 +38,6 @@
if (group == null)
throw new InvalidOperationException
("Unknown action group: " + groupToEdit);
Load (group);
- groupToolbar = new ActionGroupToolbar
(frontend, groupCopy);
-
undoManager = new UndoRedoManager ();
undoQueue = new UndoQueue ();
undoManager.UndoQueue = undoQueue;
@@ -47,13 +46,8 @@
else {
if (!autoCommitChanges)
throw new System.NotSupportedException
();
- Stetic.Wrapper.Container container =
project.GetTopLevelWrapper (containerName, true);
- groupToolbar = new ActionGroupToolbar
(frontend, container.LocalActionGroups);
}
- designer = UserInterface.CreateActionGroupDesigner
(project, groupToolbar);
- designer.Editor.GroupModified += OnModified;
-
- project.ProjectReloaded += new EventHandler
(OnProjectReloaded);
+ project.ProjectReloaded += OnProjectReloaded;
}
public Wrapper.ActionGroup EditedActionGroup {
@@ -125,22 +119,26 @@
public void CopySelection ()
{
- designer.Editor.Copy ();
+ if (designer != null)
+ designer.Editor.Copy ();
}
public void CutSelection ()
{
- designer.Editor.Cut ();
+ if (designer != null)
+ designer.Editor.Cut ();
}
public void PasteToSelection ()
{
- designer.Editor.Paste ();
+ if (designer != null)
+ designer.Editor.Paste ();
}
public void DeleteSelection ()
{
- designer.Editor.Delete ();
+ if (designer != null)
+ designer.Editor.Delete ();
}
void OnProjectReloaded (object s, EventArgs a)
@@ -172,7 +170,12 @@
}
public bool HasData {
- get { return groupToolbar.ActionGroups.Count > 0; }
+ get {
+ if (groupToEdit != null)
+ return true;
+ Stetic.Wrapper.Container container =
project.GetTopLevelWrapper (containerName, true);
+ return container.LocalActionGroups.Count > 0;
+ }
}
public bool Modified {
@@ -182,34 +185,61 @@
public string ActiveGroup {
get {
- Wrapper.ActionGroup grp =
designer.Toolbar.ActiveGroup;
- if (grp != null)
- return grp.Name;
- else
- return null;
+ if (designer != null) {
+ Wrapper.ActionGroup grp =
designer.Toolbar.ActiveGroup;
+ if (grp != null)
+ return grp.Name;
+ }
+ return null;
}
set {
- Wrapper.ActionGroup grp =
designer.Toolbar.ActionGroups [value];
- designer.Toolbar.ActiveGroup = grp;
+ if (value != null || designer != null) {
+ // No need to create the designer if
the active group is being set to null.
+ Wrapper.ActionGroup grp =
Backend.Toolbar.ActionGroups [value];
+ Backend.Toolbar.ActiveGroup = grp;
+ }
}
}
public void SetSelectedAction (Wrapper.Action action)
{
- designer.Editor.SelectedAction = action;
+ // No need to create the designer if the active action
is being set to null.
+ if (action != null || designer != null)
+ Backend.Editor.SelectedAction = action;
}
public void GetSelectedAction (out Wrapper.Action action, out
string name)
{
- action = designer.Editor.SelectedAction;
- if (action != null)
- name = action.Name;
- else
+ if (designer != null) {
+ action = designer.Editor.SelectedAction;
+ if (action != null)
+ name = action.Name;
+ else
+ name = null;
+ } else {
+ action = null;
name = null;
+ }
}
public ActionGroupDesignerBackend Backend {
- get { return designer; }
+ get {
+ if (designer == null) {
+
+ if (groupToEdit != null) {
+ groupToolbar = new
ActionGroupToolbar (frontend, groupCopy);
+ }
+ else {
+ Stetic.Wrapper.Container
container = project.GetTopLevelWrapper (containerName, true);
+ groupToolbar = new
ActionGroupToolbar (frontend, container.LocalActionGroups);
+ }
+
+ designer =
UserInterface.CreateActionGroupDesigner (project, groupToolbar);
+ designer.Editor.GroupModified +=
OnModified;
+ designer.Toolbar.AllowActionBinding =
allowActionBinding;
+ }
+ return designer;
+ }
}
[NoGuiDispatch]
@@ -225,20 +255,33 @@
public void DestroyBackendWidgetPlug ()
{
- Gtk.Plug plug = (Gtk.Plug) Backend.Parent;
- plug.Remove (Backend);
- plug.Destroy ();
+ if (designer != null) {
+ Gtk.Plug plug = (Gtk.Plug) designer.Parent;
+ plug.Remove (designer);
+ plug.Destroy ();
+ }
}
public bool AllowActionBinding {
- get { return designer.Toolbar.AllowActionBinding; }
- set { designer.Toolbar.AllowActionBinding = value; }
+ get {
+ return allowActionBinding;
+ }
+ set {
+ allowActionBinding = value;
+ if (designer != null)
+ designer.Toolbar.AllowActionBinding =
value;
+ }
}
public void Dispose ()
{
+ if (designer != null)
+ designer.Editor.GroupModified -= OnModified;
+ project.ProjectReloaded -= OnProjectReloaded;
+
if (plug != null)
plug.Destroy ();
+
System.Runtime.Remoting.RemotingServices.Disconnect
(this);
}
Modified: trunk/stetic/libsteticui/ActionGroupToolbar.cs
===================================================================
--- trunk/stetic/libsteticui/ActionGroupToolbar.cs 2007-02-19 13:30:43 UTC
(rev 73115)
+++ trunk/stetic/libsteticui/ActionGroupToolbar.cs 2007-02-19 13:37:43 UTC
(rev 73116)
@@ -16,6 +16,9 @@
bool singleGroupMode;
bool allowBinding;
ActionGroupDesignerFrontend frontend;
+ Editor.ActionGroupEditor agroupEditor;
+ Gtk.ToolButton addButton;
+ Gtk.ToolButton removeButton;
public event ActionGroupEventHandler ActiveGroupChanged;
public event ActionGroupEventHandler ActiveGroupCreated;
@@ -63,15 +66,15 @@
Insert (comboItem, -1);
internalButtons.Add (comboItem);
- Gtk.ToolButton but = new Gtk.ToolButton
(Gtk.Stock.Add);
- but.Clicked += OnAddGroup;
- Insert (but, -1);
- internalButtons.Add (but);
+ addButton = new Gtk.ToolButton (Gtk.Stock.Add);
+ addButton.Clicked += OnAddGroup;
+ Insert (addButton, -1);
+ internalButtons.Add (addButton);
- but = new Gtk.ToolButton (Gtk.Stock.Remove);
- but.Clicked += OnRemoveGroup;
- Insert (but, -1);
- internalButtons.Add (but);
+ removeButton = new Gtk.ToolButton
(Gtk.Stock.Remove);
+ removeButton.Clicked += OnRemoveGroup;
+ Insert (removeButton, -1);
+ internalButtons.Add (removeButton);
ActionGroups = actionGroups;
@@ -86,6 +89,17 @@
public override void Dispose ()
{
+ combo.Changed -= OnActiveChanged;
+ if (addButton != null) {
+ addButton.Clicked -= OnAddGroup;
+ removeButton.Clicked -= OnRemoveGroup;
+ }
+
+ if (agroupEditor != null) {
+ agroupEditor.SelectionChanged -=
OnEditorSelectionChanged;
+ agroupEditor = null;
+ }
+
base.Dispose ();
if (!singleGroupMode)
ActionGroups = null;
@@ -116,19 +130,16 @@
public void Bind (Editor.ActionGroupEditor agroupEditor)
{
- ActiveGroupChanged += delegate (object s,
Wrapper.ActionGroupEventArgs args) {
- agroupEditor.ActionGroup = args.ActionGroup;
- };
- ActiveGroupCreated += delegate (object s,
Wrapper.ActionGroupEventArgs args) {
- agroupEditor.StartEditing ();
- };
-
- agroupEditor.SelectionChanged += delegate (object s,
EventArgs args) {
- UpdateActionCommands
(agroupEditor.SelectedAction);
- };
+ this.agroupEditor = agroupEditor;
+ agroupEditor.SelectionChanged +=
OnEditorSelectionChanged;
agroupEditor.ActionGroup = ActiveGroup;
}
+ public void OnEditorSelectionChanged (object s, EventArgs a)
+ {
+ UpdateActionCommands (agroupEditor.SelectedAction);
+ }
+
public ActionGroup ActiveGroup {
get {
return currentGroup;
@@ -137,8 +148,7 @@
if (singleGroupMode) {
currentGroup = value;
UpdateActionCommands (null);
- if (ActiveGroupChanged != null)
- ActiveGroupChanged (this, new
ActionGroupEventArgs (ActiveGroup));
+ NotifyActiveGroupChanged ();
} else {
int i = actionGroups.IndexOf (value);
if (i != -1)
@@ -196,6 +206,9 @@
combo.Active = actionGroups.Count - 1;
if (ActiveGroupCreated != null)
ActiveGroupCreated (this, new
ActionGroupEventArgs (ActiveGroup));
+
+ if (agroupEditor != null)
+ agroupEditor.StartEditing ();
}
void OnRemoveGroup (object s, EventArgs args)
@@ -212,11 +225,18 @@
currentGroup = (ActionGroup)
actionGroups [combo.Active];
else
currentGroup = null;
- if (ActiveGroupChanged != null)
- ActiveGroupChanged (this, new
ActionGroupEventArgs (ActiveGroup));
+ NotifyActiveGroupChanged ();
}
}
+ void NotifyActiveGroupChanged ()
+ {
+ if (agroupEditor != null)
+ agroupEditor.ActionGroup = ActiveGroup;
+ if (ActiveGroupChanged != null)
+ ActiveGroupChanged (this, new
ActionGroupEventArgs (ActiveGroup));
+ }
+
void UpdateActionCommands (Action action)
{
foreach (Gtk.Widget w in Children) {
Modified: trunk/stetic/libsteticui/PluggableWidget.cs
===================================================================
--- trunk/stetic/libsteticui/PluggableWidget.cs 2007-02-19 13:30:43 UTC (rev
73115)
+++ trunk/stetic/libsteticui/PluggableWidget.cs 2007-02-19 13:37:43 UTC (rev
73116)
@@ -21,8 +21,11 @@
protected void AddCustomWidget (Gtk.Widget w)
{
- if (initialized)
+ if (initialized) {
+ Gtk.Widget cw = Child;
Remove (Child);
+ cw.Destroy ();
+ }
else
initialized = true;
Add (w);
@@ -65,8 +68,11 @@
return;
if (!app.UseExternalBackend) {
- if (Child != null)
+ if (Child != null) {
+ Gtk.Widget cw = Child;
Remove (Child);
+ cw.Destroy ();
+ }
Gtk.Widget w = OnCreateWidget ();
w.Show ();
Add (w);
@@ -93,7 +99,9 @@
return;
if (app.UseExternalBackend) {
+ Gtk.Widget w = Child;
Remove (Child);
+ w.Destroy ();
socket.Dispose ();
ConnectPlug ();
}
Modified: trunk/stetic/libsteticui/WidgetDesigner.cs
===================================================================
--- trunk/stetic/libsteticui/WidgetDesigner.cs 2007-02-19 13:30:43 UTC (rev
73115)
+++ trunk/stetic/libsteticui/WidgetDesigner.cs 2007-02-19 13:37:43 UTC (rev
73116)
@@ -58,6 +58,8 @@
// Creates an action group designer for the widget being edited
by this widget designer
public ActionGroupDesigner CreateActionGroupDesigner ()
{
+ if (disposed)
+ throw new ObjectDisposedException
("WidgetDesigner");
return new ActionGroupDesigner (editedProject,
componentName, null, this, true);
}
@@ -67,7 +69,8 @@
public void SetActive ()
{
- project.App.ActiveProject = editedProject;
+ if (!disposed)
+ project.App.ActiveProject = editedProject;
}
public bool AllowWidgetBinding {
@@ -166,14 +169,20 @@
editedProject.BackendChanged -= OnProjectBackendChanged;
project.BackendChanged -= OnProjectBackendChanged;
+ if (session != null) {
+ session.Dispose ();
+ session = null;
+ }
+
if (!autoCommitChanges)
editedProject.Dispose ();
-
- if (session != null)
- session.Dispose ();
+
base.Dispose ();
System.Runtime.Remoting.RemotingServices.Disconnect
(frontend);
+ frontend = null;
+ rootWidget = null;
+ selection = null;
}
public void Save ()
@@ -184,7 +193,7 @@
void OnComponentNameChanged (object s, ComponentNameEventArgs
args)
{
- if (ComponentNameChanged != null)
+ if (!disposed && ComponentNameChanged != null)
ComponentNameChanged (this, args);
}
Modified: trunk/stetic/libsteticui/WidgetEditSession.cs
===================================================================
--- trunk/stetic/libsteticui/WidgetEditSession.cs 2007-02-19 13:30:43 UTC
(rev 73115)
+++ trunk/stetic/libsteticui/WidgetEditSession.cs 2007-02-19 13:37:43 UTC
(rev 73116)
@@ -187,21 +187,25 @@
if (toolbar != null)
toolbar.Destroy ();
- gproject.ProjectReloaded -= new EventHandler
(OnProjectReloaded);
+ gproject.ModifiedChanged -= new EventHandler
(OnModifiedChanged);
+ gproject.Changed -= new EventHandler (OnChanged);
+ gproject.ProjectReloaded -= OnProjectReloaded;
// gproject.WidgetMemberNameChanged -= new
Stetic.Wrapper.WidgetNameChangedHandler (OnWidgetNameChanged);
if (!autoCommitChanges) {
// The global action group is being managed by
the real stetic project,
// so we need to remove it from the project
copy before disposing it.
gproject.ActionGroups = null;
- gproject.Dispose ();
+
+ // Don't dispose the project here! it will be
disposed by the frontend
if (widget != null) {
widget.SelectionChanged -=
OnSelectionChanged;
- widget.Dispose ();
- widget.Destroy ();
+ // Don't dispose the widget. It will be
disposed when destroyed together
+ // with the container
widget = null;
}
}
+
if (plug != null)
plug.Destroy ();
gproject = null;
Modified: trunk/stetic/libsteticui/WidgetFactory.cs
===================================================================
--- trunk/stetic/libsteticui/WidgetFactory.cs 2007-02-19 13:30:43 UTC (rev
73115)
+++ trunk/stetic/libsteticui/WidgetFactory.cs 2007-02-19 13:37:43 UTC (rev
73116)
@@ -127,5 +127,11 @@
{
return instance;
}
+
+ public override void Dispose ()
+ {
+ base.Dispose ();
+ instance.Destroy ();
+ }
}
}
Modified: trunk/stetic/libsteticui/libsteticui.mdp
===================================================================
--- trunk/stetic/libsteticui/libsteticui.mdp 2007-02-19 13:30:43 UTC (rev
73115)
+++ trunk/stetic/libsteticui/libsteticui.mdp 2007-02-19 13:37:43 UTC (rev
73116)
@@ -94,7 +94,7 @@
<ProjectReference type="Project" localcopy="True" refto="libstetic" />
<ProjectReference type="Assembly" localcopy="True"
refto="./lib/Mono.Cecil.dll" />
</References>
- <MonoDevelop.Autotools.MakefileInfo IntegrationEnabled="True"
RelativeMakefileName="./Makefile.am" ExecuteTargetName="" SyncReferences="True"
IsAutotoolsProject="True" RelativeConfigureInPath="../" OutputDirVar=""
AssemblyNameVar="">
+ <MonoDevelop.Autotools.MakefileInfo IntegrationEnabled="True"
RelativeMakefileName="./Makefile.am" SyncReferences="True"
IsAutotoolsProject="True" RelativeConfigureInPath="../">
<BuildFilesVar Sync="True" Name="libsteticui_dll_sources" />
<DeployFilesVar Sync="True" Name="libsteticui_dll_datafiles" />
<ResourcesVar Sync="True" Name="libsteticui_dll_resources" />
Modified: trunk/stetic/stetic/stetic.mdp
===================================================================
--- trunk/stetic/stetic/stetic.mdp 2007-02-19 13:30:43 UTC (rev 73115)
+++ trunk/stetic/stetic/stetic.mdp 2007-02-19 13:37:43 UTC (rev 73116)
@@ -32,7 +32,7 @@
<ProjectReference type="Project" localcopy="True" refto="libstetic" />
<ProjectReference type="Project" localcopy="True" refto="libsteticui" />
</References>
- <MonoDevelop.Autotools.MakefileInfo IntegrationEnabled="True"
RelativeMakefileName="./Makefile.am" ExecuteTargetName="" SyncReferences="True"
IsAutotoolsProject="True" RelativeConfigureInPath="../" OutputDirVar=""
AssemblyNameVar="">
+ <MonoDevelop.Autotools.MakefileInfo IntegrationEnabled="True"
RelativeMakefileName="./Makefile.am" SyncReferences="True"
IsAutotoolsProject="True" RelativeConfigureInPath="../">
<BuildFilesVar Sync="True" Name="stetic_exe_sources" />
<DeployFilesVar />
<ResourcesVar Sync="True" Name="stetic_exe_resources" />
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches