diff options
author | Vsevolod Kukol <sevoku@microsoft.com> | 2019-01-07 19:17:28 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-07 19:17:28 +0300 |
commit | b57194e95dc6f102cf0f5f0a949e5a4436ab5895 (patch) | |
tree | 36cdae43d61db2c6dd9edc434e6f05f755e13548 | |
parent | a148518386050a1fdb509a8ebd4d1cb918c72acb (diff) | |
parent | 85d9b7f42a066f4027bc05813375470b13b1e778 (diff) |
Merge pull request #907 from mono/check-for-disposed-windows
Check for disposed windows
-rw-r--r-- | Xwt/Xwt/Widget.cs | 8 | ||||
-rwxr-xr-x | Xwt/Xwt/XwtComponent.cs | 8 |
2 files changed, 13 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 (); 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 |