call to subplot() changes current figure to last figure modified
Bug Description
When generating 2 (or more) figures and selecting ( scf() ) another than the last, a subseqent call to subplot() changes the current figure to the last generated.
Steps to reproduce
// first figure
fh0 = scf();
subplot(2,1,1);
plot2d([1,2],[-2,2],1);
subplot(2,1,2);
plot2d([1,2],[-2,2],1);
fa = gcf();
printf("scf() figure id: %d\n",fh0.figure_id);
// second figure
fh1 = scf();
subplot(2,1,1);
plot2d([1,2],[2,-2],1);
subplot(2,1,2);
plot2d([1,2],[2,-2],1);
fa = gcf();
printf("scf() figure id: %d\n",fh1.figure_id);
// selecting the first one
scf(fh0);
fa = gcf();
printf("scf(%d) figure id: %d \n",fh0.figure_id,fa.figure_id);
// call subplot
subplot(2,1,1);
plot2d([1,2],[-2,2],2);
fa = gcf();
printf("subplot() figure id: %d \n",fa.figure_id);
// ver();
Output
scf() figure id: 0 scf() figure id: 1 scf(0) figure id: 0 subplot() figure id: 1
"Scilab Version: " "2024.0.0.1698152370"
"Operating System: " "Linux 4.18.0-477.27.2.el8_8.x86_64"
"Java version: " "17.0.7"
"Java runtime information: " "OpenJDK Runtime Environment (build 17.0.7+7)"
"Java Virtual Machine information: " "OpenJDK 64-Bit Server VM (build 17.0.7+7, mixed mode, sharing)" "Vendor specification: " "Oracle Corporation"
What is the expected correct behavior?
the current figure should remain stable.
Probably these could be caused by a call to gce() in the subplot function ( line 29 / subplot.sci )
Edited by Vincent COUVERT