* Bug 15996 fixed [gui] restore figure "closerequestfcn" to its high priority. 72/21272/2
Antoine ELIAS [Sun, 2 Feb 2020 14:34:25 +0000 (15:34 +0100)]
  http://bugzilla.scilab.org/15996

Change-Id: Ib57eddde3349ceea699e207914cd806d02ec9cca

scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/tab/SwingScilabDockablePanel.java
scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/window/SwingScilabStaticWindow.java
scilab/modules/gui/tests/nonreg_tests/bug_15996.tst [new file with mode: 0644]

index 63ae233..601e532 100644 (file)
@@ -350,7 +350,7 @@ public class SwingScilabDockablePanel extends View implements SimpleTab, FocusLi
                                           + "gcbo = getcallbackobject(" + getId() + ");"
                                           + closeRequestFcn + ";fire_closing_finished();"
                                           + ";if exists(\"%oldgcbo\") then gcbo = %oldgcbo; else clear gcbo; end;";
-                    InterpreterManagement.putCommandInScilabQueue(closeCommand);
+                    InterpreterManagement.requestScilabExec(closeCommand);
                     return -1;
                 } else {
                     closeAction.actionPerformed(null);
index 9b44578..ff07db3 100644 (file)
@@ -42,7 +42,7 @@ public class SwingScilabStaticWindow extends SwingScilabWindow {
                 if (!closeRequestFcn.equals("")) {
                     String closeCommand = "if exists(\"gcbo\") then %oldgcbo = gcbo; end;" + "gcbo = getcallbackobject(" + panel.getId() + ");" + closeRequestFcn
                                           + ";if exists(\"%oldgcbo\") then gcbo = %oldgcbo; else clear gcbo; end;";
-                    InterpreterManagement.putCommandInScilabQueue(closeCommand);
+                    InterpreterManagement.requestScilabExec(closeCommand);
                 } else {
                     //GraphicController.getController().deleteObject(panel.getId());
                     CommonCallBack callback = panel.getCallback();
diff --git a/scilab/modules/gui/tests/nonreg_tests/bug_15996.tst b/scilab/modules/gui/tests/nonreg_tests/bug_15996.tst
new file mode 100644 (file)
index 0000000..2e7c429
--- /dev/null
@@ -0,0 +1,36 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2020 - ESI Group - Antoine ELIAS
+//
+//  This file is distributed under the same license as the Scilab package.
+// =============================================================================
+//
+// <-- TEST WITH GRAPHIC -->
+// <-- INTERACTIVE TEST -->
+//
+// <-- Non-regression test for bug 15996 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/15996
+//
+// <-- Short Description -->
+// Priority of closerequestfcn and callbacks with while loop
+
+function quit_waiter()
+    a = resume(1);
+endfunction
+
+figure(...
+    "tag", "quit_fig", ...
+    "closerequestfcn", "quit_waiter");
+
+printf("Close the figure to continue");
+
+a = 0;
+tic();
+while a == 0
+    printf("\r");printf("%0.2f", toc());
+    sleep(50);
+end
+
+delete(get("quit_fig"));