Re: [RFA 19/23] Replace do_restore_instream_cleanup with scoped_restore

Pedro Alves
2017-06-05T13:49:12Z

On 05/03/2017 11:46 PM, Tom Tromey wrote:
> This changes the users of do_restore_instream_cleanup to use a
> scoped_restore instead. This patch is broken out because it warrants
> some additional attention: in particular it's unclear to me whether
> current_ui can change in the body of these functions -- but if it can,
> then the cleanup would have modified a different UI's instream member.
>

The only places that change the current UI without restoring it
back are the top level event loop code that reacts to stdin input
and signal handlers (stdin_event_handler / invoke_async_signal_handlers).
Everything else that temporarily switches UI switches back before
returning, using scoped_restore. (This includes nested even loops like
wait_sync_command_done.)

> 2017-05-02 Tom Tromey <tom@tromey.com>
>
> * top.h (do_restore_instream_cleanup): Remove.
> * top.c (do_restore_instream_cleanup): Remove.
> (read_command_file): Use scoped_restore.
> * cli/cli-script.c (execute_user_command): Use scoped_restore.

OK.

Thanks,
Pedro Alves