From ed41bd7cb8c6ee8112ddefb58ecfaad01773b7de Mon Sep 17 00:00:00 2001 From: Simonas G Date: Wed, 15 Jan 2025 14:32:10 +0200 Subject: [PATCH] Allow disposing multiple times --- src/Eto/Widget.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Eto/Widget.cs b/src/Eto/Widget.cs index f498bc0050..d56dfc6c5c 100644 --- a/src/Eto/Widget.cs +++ b/src/Eto/Widget.cs @@ -539,7 +539,7 @@ protected virtual void Dispose(bool disposing) { if (disposing) { - if (Handler is IDisposable handler) + if (!IsDisposed && Handler is IDisposable handler) handler.Dispose(); IsDisposed = true; Handler = null; @@ -560,4 +560,4 @@ public override string ToString() else return base.ToString(); } -} \ No newline at end of file +}