bugGNU Octave - Bugs: bug #53729, Qt figure canvas does not resize...


bug #53729: Qt figure canvas does not resize with window while interpreter is paused or blocked

Submitted by:  A.R. Burgers <arb>
Submitted on:  Mon 23 Apr 2018 07:51:13 PM UTC  
Category:  Plotting with OpenGL Severity:  2 - Minor
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  Closed
Release:  dev Operating System:  GNU/Linux

Add a New Comment(Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


( Jump to the original submission)

Thu 13 Dec 2018 09:14:07 PM UTC, comment #24:

Yes, you are right. Closing report as fixed.

Pantxo Diribarne <pantxo>
Project Member
Thu 13 Dec 2018 08:28:43 PM UTC, comment #23:

This bug is marked as "Ready for Test". Can it be closed now?

It seems like the remaining issue is really addressed in bug #55029.

Rik <rik5>
Project Administrator
Thu 15 Nov 2018 10:06:19 PM UTC, comment #22:

@Michael: Yes, the "x" is echoed and octave returns to prompt.

I am on linux mint 19 which has debian/ubuntu package libreadline7 (7.0-3).

Pantxo Diribarne <pantxo>
Project Member
Thu 15 Nov 2018 09:05:18 PM UTC, comment #21:

This could have something to do with readline version.
FC29 has readline-7.0-12.fc29.x86_64


actually exit pause for you?

Michael Godfrey <godfrey>
Project Member
Thu 15 Nov 2018 08:57:30 PM UTC, comment #20:

@Michael: I cannot reproduce the hang, but at least I can reproduce the fact that characters are echoed in the terminal. The latter is for sure a side effect of the patch I pushed. I'll look into this.

Pantxo Diribarne <pantxo>
Project Member
Thu 15 Nov 2018 08:43:52 PM UTC, comment #19:

Pantxo suggested that I mention bug #55029 here.
This report points out that pause with no argument
hangs Octave. Could this be a side-effect of this

Michael Godfrey <godfrey>
Project Member
Tue 06 Nov 2018 01:12:53 PM UTC, comment #18:

@arb: Can you confirm this report can be closed?

Pantxo Diribarne <pantxo>
Project Member
Sun 04 Nov 2018 07:58:22 PM UTC, comment #17:

I pushed the change here:


Pantxo Diribarne <pantxo>
Project Member
Wed 31 Oct 2018 10:20:37 PM UTC, comment #16:

@arb: I attached an updated patch that handles "query". I opted for the static variable even though, indeed, it would be nice to safely store this kind of static variables into the interpreter object but it is probably part of another (bigger) task.

(file #45341)

Pantxo Diribarne <pantxo>
Project Member
Wed 31 Oct 2018 09:13:48 AM UTC, comment #15:

looks good.

The patch does not handle pause('query').

It requires on/off to be in all lower case, but matlab requires that as well.

An interpreter global is more save than a static C variable in the long run? Multiple interpreter instances might be possible in the future? The parallel package forks multiple instances, but I guess that is fine with a static variable.

A.R. Burgers <arb>
Tue 30 Oct 2018 09:52:07 PM UTC, comment #14:

@arb: I attached a patch in which I implemented this functionality in C++.

@jwe: Is it OK to use a static variable to store the state of the pause function or should I make it a more fundamental global variable (like other Vxxx variables)?

(file #45330)

Pantxo Diribarne <pantxo>
Project Member
Fri 26 Oct 2018 07:20:47 AM UTC, comment #13:

One approach could be a wrapper in m-code around the current c++ that implements the pause on/off/query functionality? I made a draft below:

A.R. Burgers <arb>
Thu 25 Oct 2018 12:56:49 PM UTC, comment #12:

I use for instance a workflow where I have a sequence of

possibly spread across multiple functions. When I am happy with the plots, I can then conveniently generate hardcopies, on Linux at least, in batch with the input redirection. Or for debugging purpose, if somewhere an error occurs, with the redirection you can progress more quickly to that spot.

Anyway I find myself using this redirection feature quite frequently, which probably is the reasons why I hit upon this side effect.

I could change pause calls to pause(xx) calls, and change xx to a small value for batch, but that is a little bit awkward with plots generated in different functions.

Matlab has the pause('on')/pause('off') feature with I guess would be suitable for this, but octave's pause does not provide that.

A.R. Burgers <arb>
Thu 25 Oct 2018 12:21:11 PM UTC, comment #11:

@arb: indeed, I observe the same. It is probably due to the behavior of "kbhit (wait = true)" (the way we used to implement "pause()") which seems to return immediately if the input has been redirected. Now that we use "c = kbhit (wait = false)" for detecting keyboard inputs, the redirection is not detected anymore.

Now, before trying to find a solution (detecting manually the redirection, something that also works on Windows ...) can you tell me how important is this problem . Why do you use such redirection and can't you do it another way? ...
To be honest I was happy to work on making figures responsive while the interpreter is in pause (I see many use cases), but I'll need some convincing arguments before I try to solve what looks to me like a very minor regression.

Pantxo Diribarne <pantxo>
Project Member
Thu 25 Oct 2018 11:29:59 AM UTC, comment #10:

I tested the patch in 5.0.0.
Resizing does work now during pause, thanks!

However I do notice a side effect, on Linux, in combination with input redirection.

Save the script from the original submission as issue53729.m

then the following will show the plot

and on output:

where as in octave-5.5.0


and will not resume executing after the pause, remains executing the pause.

A.R. Burgers <arb>
Tue 23 Oct 2018 09:46:02 PM UTC, comment #9:

I pushed the patch here:


Marking "Ready For Test".

Pantxo Diribarne <pantxo>
Project Member
Tue 23 Oct 2018 03:54:38 PM UTC, comment #8:

>> Is that the expected behavior, that they are queued?

In most places the GUI uses gh_manager::post_set to change properties, so that the actual property changes only happen when the graphics events queue is processed.
There are exceptions though, in a few places we directly use graphics_properties::set after having locked the graphics mutex, or in the case of the "view" property we directly call axes::properties::translate_view. In that case, even though the property change takes effect immediately, listeners are queued if the call has happened in the GUI thread (see https://octave.org/doxygen/4.4/d7/dd3/graphics_8cc_source.html#l10218) and the interpreter will still be called only when the graphics events queue is processed.

Pantxo Diribarne <pantxo>
Project Member
Tue 23 Oct 2018 02:59:15 PM UTC, comment #7:

OK, though it does appear that the events (calls to the listener function) are eventually all processed at the end of the loop. Is that the expected behavior, that they are queued?

In any case, I think it is OK to apply the patch, so go ahead and push it. Thanks.

John W. Eaton <jwe>
Project Administrator
Tue 23 Oct 2018 02:22:12 PM UTC, comment #6:

We want the graphics event processing to be triggered when one of those conditions is met:

AFAICS the above works well in Octave. During the execution of "pause" though, we want event processing to happen regularly since menu actions should take effect as fast as possible. That is what the patch for this bug does.

In the example you provided, unless you add a call to drawnow, figure, ... or pause in the loop, the event processing won't be triggered. That is currently how it works and my patch doesn't change anything about that.

Pantxo Diribarne <pantxo>
Project Member
Tue 23 Oct 2018 01:41:51 PM UTC, comment #5:

Pantxo: I asked because I wasn't sure whether it would be safe to call a function while the interpreter was paused. The state of the interpreter could be anything. Currently, if I do something like this:

and then rotate the axes while the loop is executing, all the calls to my_listener are deferred until the interpreter is finished executing the loop. Do your patches change that behavior?

Either way, should it be possible to execute callbacks while the loop is running in the above example? If so, then I suppose executing them inside the pause function should also be allowed. But if not, why is the pause function special?

John W. Eaton <jwe>
Project Administrator
Tue 23 Oct 2018 07:19:52 AM UTC, comment #4:

@jwe: I was bout to push this patch together with the patch for bug #54340 (which refactors graphics events handling).
I would like to be sure I understand your concern before making a decision. Could elaborate a bit and explain what problem you anticipate and in what situation?

Pantxo Diribarne <pantxo>
Project Member
Mon 22 Oct 2018 06:33:48 PM UTC, comment #3:

I can't see a situation where this patch could cause problems. As other builtin functions I expect Fpause to be called from the interpreter thread, and the call to process_events thus happens in this thread. In this situation I expext the interpreter to be ready to eval any user code.

Pantxo Diribarne <pantxo>
Project Member
Mon 22 Oct 2018 05:07:00 PM UTC, comment #2:

What happens when a graphics event involves a callback function that requires the interpreter? Can we guarantee that it is OK to execute a callback function when the interpreter is waiting inside another function call?

John W. Eaton <jwe>
Project Administrator
Mon 22 Oct 2018 02:37:20 PM UTC, comment #1:

I attached a patch that solves this issue for me. Can someone confirm?

(file #45256)

Pantxo Diribarne <pantxo>
Project Member
Mon 23 Apr 2018 07:51:13 PM UTC, original submission:

with this script

then invoked, with --persist as

which produces

while the pause is active, all interaction with the plot is possible and works. A resize of the window however does resize the window, but not the plot. After the pause, returning to the command prompt, the plot can be resized.

A.R. Burgers <arb>


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

Attached Files
file #45341:  pause_state2.patch added by pantxo (4KiB - text/x-patch)
file #45330:  pause_state.patch added by pantxo (3KiB - text/x-patch)
file #45256:  pause_graphics_events.patch added by pantxo (7KiB - text/x-patch)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by godfrey (Posted a comment)
  • -email is unavailable- added by jwe (Posted a comment)
  • -email is unavailable- added by pantxo (Updated the item)
  • -email is unavailable- added by arb (Submitted the item)

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.




    Follow 12 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2018-12-13 pantxo StatusReady For Test => Fixed
        Open/ClosedOpen => Closed
    2018-10-31 pantxo Attached File- => Added pause_state2.patch, #45341
    2018-10-30 pantxo Attached File- => Added pause_state.patch, #45330
    2018-10-23 pantxo StatusPatch Submitted => Ready For Test
    2018-10-22 mtmiller Carbon-CopyRemoved 80942 => -
    2018-10-22 pantxo Attached File- => Added pause_graphics_events.patch, #45256
        StatusConfirmed => Patch Submitted
    2018-05-01 mtmiller Severity3 - Normal => 2 - Minor
        StatusNone => Confirmed
        Release4.3.91 => dev
        Summaryplot cannot be resized during pause, => Qt figure canvas does not resize with window while interpreter is paused or blocked

    Back to the top

    Powered by Savane 3.4