From e9ddf6290be608313a1b31420e8620eec8bbca1f Mon Sep 17 00:00:00 2001 From: Antoine ELIAS Date: Fri, 26 Mar 2021 11:13:37 +0100 Subject: [PATCH] reduce depth search to find figure during closing Change-Id: I9baebc842b7e1780e4c579d74eb035332608baea --- .../gui/bridge/tab/SwingScilabCommonPanel.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/tab/SwingScilabCommonPanel.java b/scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/tab/SwingScilabCommonPanel.java index bb59d4e6..77b8287 100644 --- a/scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/tab/SwingScilabCommonPanel.java +++ b/scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/tab/SwingScilabCommonPanel.java @@ -130,9 +130,15 @@ public class SwingScilabCommonPanel { } /* Update callback */ - String closingCommand = "if (findobj(\"figure_id\", " + figureId + ") <> []) then" + " if (get(findobj(\"figure_id\", " + figureId + "), 'event_handler_enable') == 'on') then" - + " execstr(get(findobj(\"figure_id\", " + figureId + "), 'event_handler')+'(" + figureId + ", -1, -1, -1000)', 'errcatch', 'm');" + " end;" + " delete(findobj(\"figure_id\", " - + figureId + "));" + "end;"; + String closingCommand = "%closing_fig = findobj('figure_id', " + figureId + ", '-flat');" + + "if (%closing_fig <> []) then" + + " if (get(%closing_fig, 'event_handler_enable') == 'on') then" + + " execstr(get(%closing_fig, 'event_handler')+'(" + figureId + ", -1, -1, -1000)', 'errcatch', 'm');" + + " end;" + + " delete(%closing_fig);" + + "end;" + + "clear('%closing_fig');"; + component.setCallback(null); component.setCallback(ScilabCloseCallBack.create(component.getId(), closingCommand)); /* Update menus callback */ @@ -196,7 +202,7 @@ public class SwingScilabCommonPanel { int state = component.getParentWindow().getExtendedState(); if((state & SwingScilabWindow.ICONIFIED) == SwingScilabWindow.ICONIFIED) { component.getParentWindow().setExtendedState(state - SwingScilabWindow.ICONIFIED); - } + } } break; case __GO_INFOBAR_VISIBLE__: { -- 1.7.9.5