From 21f2edd8b0dbc00ce4e49d82be7c22eed072e42e Mon Sep 17 00:00:00 2001 From: Joseph Battelle Date: Mon, 1 Feb 2021 17:54:40 -0800 Subject: [PATCH] Fix IDE 'SecondaryAllowClose' on inactive tabs When closing secondary IDE Windows that have changes for inactive sourceViewPanels the current logic checks 'mWidgetWindow' against the window to decide if it should be included in the close query. Inactive tabs always have null mWidgetWindows so the changes are not seen. This fixes the 'Save' button case for inactive SourceViewPanels by using per-window visitors. --- IDE/src/IDEApp.bf | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/IDE/src/IDEApp.bf b/IDE/src/IDEApp.bf index f86ba07a..ca6b033b 100644 --- a/IDE/src/IDEApp.bf +++ b/IDE/src/IDEApp.bf @@ -1243,9 +1243,9 @@ namespace IDE List changedList = scope List(); defer ClearAndDeleteItems(changedList); - WithSourceViewPanels(scope (sourceViewPanel) => + WithSourceViewPanelsOf(window, scope (sourceViewPanel) => { - if ((sourceViewPanel.mWidgetWindow == window) && (sourceViewPanel.HasUnsavedChanges())) + if (sourceViewPanel.HasUnsavedChanges()) { var fileName = new String(); Path.GetFileName(sourceViewPanel.mFilePath, fileName); @@ -1260,9 +1260,9 @@ namespace IDE bool hadError = false; // We use a close delay after saving so the user can see we actually saved before closing down var _this = this; - WithSourceViewPanels(scope [&] (sourceViewPanel) => + WithSourceViewPanelsOf(window, scope [&] (sourceViewPanel) => { - if ((!hadError) && (sourceViewPanel.mWidgetWindow == window) && (sourceViewPanel.HasUnsavedChanges())) + if ((!hadError) && (sourceViewPanel.HasUnsavedChanges())) if (!_this.SaveFile(sourceViewPanel)) hadError = true; });