[gimp] app: wait for the software to be fully initialized before processing…
- From: Jehan <jehanp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: wait for the software to be fully initialized before processing…
- Date: Tue, 10 Nov 2020 20:53:12 +0000 (UTC)
commit a86ed68870b8a3a11f0b28c688b725c696dfdaf0
Author: Jehan <jehan girinstud io>
Date: Tue Nov 10 21:40:47 2020 +0100
app: wait for the software to be fully initialized before processing…
… DBus calls.
In particular, Aryeom would start GIMP and directly double click some
image to be loaded in GIMP in the very short while when splash is
visible. Previous code would wait for the `restored` flag to be TRUE.
This was nearly it as we can actually start loading images as soon as
the 'restore' signal has passed. Yet the flag is set in the main
handler, but we actually also need the <Image> UI manager to exist,
which is created in gui_restore_after_callback() (so also a 'restore'
handler, yet after the main signal handler, i.e. after `restored` is set
to TRUE). Without this, gui_display_create() would fail with a CRITICAL,
hence file_open_with_proc_and_display() as well.
I could have tried to set the `restored` flag later, maybe with some
clever signal handling trick (and handle both the GUI and non-GUI cases,
i.e. I cannot set the flag inside gui_restore_after_callback() as it
would break the non-GUI cases). Instead I go for a simpler logics with a
new `initialized` flag which is only meant to be set once, once
everything has been loaded, i.e. once you can consider GIMP to be fully
running hence ready to process any common runtime command.
app/app.c | 3 +++
app/core/gimp.h | 1 +
app/gui/gimpdbusservice.c | 3 +--
3 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/app/app.c b/app/app.c
index a93b3b1fe0..c2f7ee3311 100644
--- a/app/app.c
+++ b/app/app.c
@@ -351,6 +351,9 @@ app_run (const gchar *full_prog_name,
G_CALLBACK (app_exit_after_callback),
&run_loop);
+ /* The software is now fully loaded and ready to be used. */
+ gimp->initialized = TRUE;
+
#ifndef GIMP_CONSOLE_COMPILATION
if (run_loop && ! no_interface)
{
diff --git a/app/core/gimp.h b/app/core/gimp.h
index 81c27ed74a..a543520d32 100644
--- a/app/core/gimp.h
+++ b/app/core/gimp.h
@@ -60,6 +60,7 @@ struct _Gimp
GimpGui gui; /* gui vtable */
gboolean restored; /* becomes TRUE in gimp_restore() */
+ gboolean initialized; /* Fully initialized (only set once at start). */
gint busy;
guint busy_idle_id;
diff --git a/app/gui/gimpdbusservice.c b/app/gui/gimpdbusservice.c
index e90c229171..04dec1a37f 100644
--- a/app/gui/gimpdbusservice.c
+++ b/app/gui/gimpdbusservice.c
@@ -328,14 +328,13 @@ gimp_dbus_service_process_idle (GimpDBusService *service)
{
IdleData *data;
- if (! service->gimp->restored)
+ if (! service->gimp->initialized || ! service->gimp->restored)
return TRUE;
data = g_queue_pop_tail (service->queue);
if (data)
{
-
if (data->file)
file_open_from_command_line (service->gimp, data->file, data->as_new,
NULL /* FIXME monitor */);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]