From ff395e94c676e417138e99c93e042c57746e23e0 Mon Sep 17 00:00:00 2001 From: Christian Hergert Date: Mon, 18 Apr 2016 00:02:50 -0700 Subject: [PATCH] window: protect against delayed ::stopped Large captures could take a while to complete the stop request, so protect against that so that the user can't accidentally start another capture. --- src/sp-window.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/sp-window.c b/src/sp-window.c index 2cf5805d..89898a4c 100644 --- a/src/sp-window.c +++ b/src/sp-window.c @@ -379,14 +379,6 @@ sp_window_start_recording (SpWindow *self) { g_assert (SP_IS_WINDOW (self)); - if (self->state == SP_WINDOW_STATE_RECORDING) - { - /* SpProfiler::stopped will move us to generating */ - gtk_label_set_label (self->subtitle, _("Stopping…")); - sp_profiler_stop (self->profiler); - return; - } - if ((self->state == SP_WINDOW_STATE_EMPTY) || (self->state == SP_WINDOW_STATE_FAILED) || (self->state == SP_WINDOW_STATE_BROWSING)) @@ -407,7 +399,16 @@ sp_window_stop_recording (SpWindow *self) if (self->state == SP_WINDOW_STATE_RECORDING) { if (self->profiler != NULL) - sp_profiler_stop (self->profiler); + { + /* SpProfiler::stopped will move us to generating */ + gtk_label_set_label (self->subtitle, _("Stopping…")); + /* + * In case that ::stopped takes a while to execute, + * disable record button immediately. + */ + gtk_widget_set_sensitive (GTK_WIDGET (self->record_button), FALSE); + sp_profiler_stop (self->profiler); + } } }