From ccf91c88ce6f4aa7715fa5284608d1d6a74180a1 Mon Sep 17 00:00:00 2001 From: Vsevolod Kukol Date: Mon, 7 Jan 2019 14:35:40 +0100 Subject: Add XwtComponent.IsDisposed --- Xwt/Xwt/XwtComponent.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Xwt/Xwt/XwtComponent.cs b/Xwt/Xwt/XwtComponent.cs index 4b5974e5..f936a3db 100755 --- a/Xwt/Xwt/XwtComponent.cs +++ b/Xwt/Xwt/XwtComponent.cs @@ -178,6 +178,14 @@ namespace Xwt } #endregion + + public bool IsDisposed { get; private set; } = false; + + protected override void Dispose (bool release_all) + { + base.Dispose (release_all); + IsDisposed = true; + } } class AsyncInvokeResult : IAsyncResult -- cgit v1.2.3 From 85d9b7f42a066f4027bc05813375470b13b1e778 Mon Sep 17 00:00:00 2001 From: Vsevolod Kukol Date: Mon, 7 Jan 2019 14:36:37 +0100 Subject: Don't reallocate disposed windows and widgets --- Xwt/Xwt/Widget.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Xwt/Xwt/Widget.cs b/Xwt/Xwt/Widget.cs index 7e69c33c..3c0189a4 100644 --- a/Xwt/Xwt/Widget.cs +++ b/Xwt/Xwt/Widget.cs @@ -1677,12 +1677,14 @@ namespace Xwt foreach (var w in toReallocate) { // The widget may already have been reallocated as a result of reallocating the parent // so we have to check if it is still in the queue - if (reallocationQueue.Contains (w)) + if (!w.IsDisposed && reallocationQueue.Contains (w)) w.Surface.Reallocate (); } foreach (var w in resizeWindows.ToArray ()) { - w.AdjustSize (); - w.Reallocate (); + if (!w.IsDisposed) { + w.AdjustSize(); + w.Reallocate(); + } } } finally { resizeRequestQueue.Clear (); -- cgit v1.2.3