ContextWindow: Dispose context after creating new one

This commit is contained in:
2024-02-29 02:04:54 +01:00
parent d897e44f3b
commit 3b94875a7f

View File

@ -46,10 +46,11 @@ namespace Elwig.Windows {
protected async Task RenewContext() { protected async Task RenewContext() {
if (!_renewPending) return; if (!_renewPending) return;
Context.Dispose(); var old = Context;
Context = new(); Context = new();
await OnRenewContext(); await OnRenewContext();
_renewPending = false; _renewPending = false;
old.Dispose();
} }
abstract protected Task OnRenewContext(); abstract protected Task OnRenewContext();