octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Questions about quitting Octave and exit confirmation dialog


From: Kai Torben Ohlhus
Subject: Re: Questions about quitting Octave and exit confirmation dialog
Date: Tue, 29 Oct 2019 14:13:08 +0900
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.1.1

On 10/29/19 11:10 AM, Daniel J Sebald wrote:
> On 10/28/19 3:38 PM, John W. Eaton wrote:
>> [...]
>>
>> Does Matlab offer a "confirm before quitting" option for its GUI?
> 
> Not sure, but there could be a confirm quit the first time and then a
> box "don't ask anymore" to check.
> 
> 

Dan is right.  For R2019a there is a configuration option explained here

   https://www.mathworks.com/help/matlab/matlab_env/exit-matlab-.html

This configuration options works as described for the GUI and this
"don't ask anymore" appears in each the confirmation dialog.

If Matlab is started by "matlab -nodesktop" the confirmation dialog does
not appear and the configuration is ignored.

>> Does that action work when quit is called from a function, or only
>> when it is executed at the command line or when Matlab is closed using
>> some "exit applcation" button in the GUI?
>>

Same applies command line, script, or function calls "exit" or "quit":
In the GUI a confirmation dialog appears the the configuration option is
set, with "-nodesktop" Matlab immediately quits without confirmation.

>> If confirmation is requested when the quit function is called from a
>> function, what does the quit function do?  Here is an example:
>>
>>    function myquit ()
>>       quit;
>>       disp ('foo-i-hithere');
>>    end
>>
>> If you call this function and a quit confirmation dialog is shown and
>> quitting is NOT confirmed, does execution continue immediately after
>> the call to "quit" so that the message displayed?  Or does execution
>> resume at the top-level command prompt with no message displayed?  I'm
>> trying to determine whether the quit function interrupts the execution
>> of a program (similar to Control-C) even if the quit action is not
>> confirmed.


In your described scenario:
(a) configuration option set
(b) function myquit called from cmd prompt
(c) quit confirmation dlg cancelled

you see the output "foo-i-hithere".  Thus the program execution does not
seem interrupted.  Only the Matlab linter suggests, that the "disp"
statement might not be reachable (no meaning at all).


> A few years back I worked hard to make all the 'quit' stuff more
> conventional, but it was kind of tricky.  I remember there being a
> particular snag, but I can't recall what it is.  I became busy with
> other things.  But there is a patch at this bug report:
> 
> https://savannah.gnu.org/bugs/?44485#comment44
> 
> There is a pretty common convention (and Windows might do this
> automatically) of confirming quit and if the application is busy put up
> a different type of dialog box like "not responding".  So involved in
> this is to tell the core worker thread to exit.  But if the core is busy
> computing pi to 5 million decimal places, then a timer in the GUI
> expires and asks if the user wants to end that process.  So, then there
> is properly shutting down a thread to deal with.  THEN, if the timer
> times out and the dialog is visible, say the worker thread finishes its
> task and responds to the exit, the dialog should go away and the GUI
> exit.  So there needs to be a signal/slot connection from the worker
> thread to the "shut-down" dialog.  Also, there could be multiple exit
> requests.  As I said, it's tricky.  It's probably dependent on how Qt
> signal/slot friendly the overall design is.
> 
> Dan
> 

My impression is, that Octave's GUI dialog and options are good and
similar to Matlab, thus need no change.  But with your changes you are
addressing bigger issues with exiting on macOS (bug #50025) and so on, I
think.

Kai



reply via email to

[Prev in Thread] Current Thread [Next in Thread]