SHA256
1
0
forked from pool/at-spi2-core

Accepting request 780005 from home:mgorse:branches:GNOME:Factory

- Ad at-spi2-core-async-session-register.patch: make bus-launcher
  session registration more robust (boo#1154582).

OBS-URL: https://build.opensuse.org/request/show/780005
OBS-URL: https://build.opensuse.org/package/show/GNOME:Factory/at-spi2-core?expand=0&rev=190
This commit is contained in:
Dominique Leuenberger 2020-03-02 09:19:55 +00:00 committed by Git OBS Bridge
parent 0d50b8c351
commit 154f7b93b4
3 changed files with 151 additions and 1 deletions

View File

@ -0,0 +1,141 @@
From 47496e0ff2571636db8f3ca8807ce11b50866130 Mon Sep 17 00:00:00 2001
From: Mike Gorse <mgorse@alum.wpi.edu>
Date: Thu, 27 Feb 2020 08:43:16 -0600
Subject: [PATCH] bus-launcher: Use async callback for RegisterClient
This should make the process more robust, in combination with setting the
timeout to G_MAXINT, rather than -1, which effectively defaults to 25
seconds. Otherwise, it is possible for the session manager to be
unresponsive, perhaps waiting for a synchronous call of its own to time out,
and then the session manager will eventually process the RegisterClient, but
at-spi-bus-launcher will have timed out, meaning that we successfully register
with the session manager but don't ever set up our signal handler, meaning
that, later, the session manager sends a QueryEndSession to us, but we don't
see it.
https://bugzilla.opensuse.org/show_bug.cgi?id=1154582
---
bus/at-spi-bus-launcher.c | 78 +++++++++++++++++++++++----------------
1 file changed, 46 insertions(+), 32 deletions(-)
diff --git a/bus/at-spi-bus-launcher.c b/bus/at-spi-bus-launcher.c
index b4f49b8..362fd05 100644
--- a/bus/at-spi-bus-launcher.c
+++ b/bus/at-spi-bus-launcher.c
@@ -69,6 +69,7 @@ typedef struct {
int pipefd[2];
int listenfd;
char *a11y_launch_error_message;
+ GDBusProxy *sm_proxy;
} A11yBusLauncher;
static A11yBusLauncher *_global_app = NULL;
@@ -139,28 +140,61 @@ client_proxy_ready_cb (GObject *source_object,
G_CALLBACK (g_signal_cb), app);
}
+static void
+client_registered (GObject *source,
+ GAsyncResult *result,
+ gpointer user_data)
+{
+ A11yBusLauncher *app = user_data;
+ GError *error = NULL;
+ GVariant *variant;
+ gchar *object_path;
+ GDBusProxyFlags flags;
+
+ variant = g_dbus_proxy_call_finish (app->sm_proxy, result, &error);
+ if (!variant)
+ {
+ if (error != NULL)
+ {
+ g_warning ("Failed to register client: %s", error->message);
+ g_error_free (error);
+ }
+ }
+ else
+ {
+ g_variant_get (variant, "(o)", &object_path);
+ g_variant_unref (variant);
+
+ flags = G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES;
+ g_dbus_proxy_new_for_bus (G_BUS_TYPE_SESSION, flags, NULL,
+ "org.gnome.SessionManager", object_path,
+ "org.gnome.SessionManager.ClientPrivate",
+ NULL, client_proxy_ready_cb, app);
+
+ g_free (object_path);
+ }
+ g_clear_object (&app->sm_proxy);
+}
+
static void
register_client (A11yBusLauncher *app)
{
GDBusProxyFlags flags;
- GDBusProxy *sm_proxy;
GError *error;
const gchar *app_id;
const gchar *autostart_id;
gchar *client_startup_id;
GVariant *parameters;
- GVariant *variant;
- gchar *object_path;
flags = G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES |
G_DBUS_PROXY_FLAGS_DO_NOT_CONNECT_SIGNALS;
error = NULL;
- sm_proxy = g_dbus_proxy_new_sync (app->session_bus, flags, NULL,
- "org.gnome.SessionManager",
- "/org/gnome/SessionManager",
- "org.gnome.SessionManager",
- NULL, &error);
+ app->sm_proxy = g_dbus_proxy_new_sync (app->session_bus, flags, NULL,
+ "org.gnome.SessionManager",
+ "/org/gnome/SessionManager",
+ "org.gnome.SessionManager",
+ NULL, &error);
if (error != NULL)
{
@@ -187,31 +221,11 @@ register_client (A11yBusLauncher *app)
g_free (client_startup_id);
error = NULL;
- variant = g_dbus_proxy_call_sync (sm_proxy,
- "RegisterClient", parameters,
- G_DBUS_CALL_FLAGS_NONE,
- -1, NULL, &error);
-
- g_object_unref (sm_proxy);
-
- if (error != NULL)
- {
- g_warning ("Failed to register client: %s", error->message);
- g_error_free (error);
-
- return;
- }
-
- g_variant_get (variant, "(o)", &object_path);
- g_variant_unref (variant);
-
- flags = G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES;
- g_dbus_proxy_new_for_bus (G_BUS_TYPE_SESSION, flags, NULL,
- "org.gnome.SessionManager", object_path,
- "org.gnome.SessionManager.ClientPrivate",
- NULL, client_proxy_ready_cb, app);
+ g_dbus_proxy_call (app->sm_proxy,
+ "RegisterClient", parameters,
+ G_DBUS_CALL_FLAGS_NONE,
+ G_MAXINT, NULL, client_registered, app);
- g_free (object_path);
}
static void
--
2.24.1

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Thu Feb 27 15:04:35 UTC 2020 - Michael Gorse <mgorse@suse.com>
- Ad at-spi2-core-async-session-register.patch: make bus-launcher
session registration more robust (boo#1154582).
-------------------------------------------------------------------
Mon Sep 9 15:08:37 CDT 2019 - mgorse@suse.com

View File

@ -1,7 +1,7 @@
#
# spec file for package at-spi2-core
#
# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
# Copyright (c) 2020 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -26,6 +26,9 @@ URL: https://www.gnome.org/
Source0: https://download.gnome.org/sources/at-spi2-core/2.34/%{name}-%{version}.tar.xz
Source99: baselibs.conf
# PATCH-FIX-UPSTREAM at-spi2-core-async-session-register.patch boo#1154582 mgorse@suse.com -- make bus-launcher session registration more robust.
Patch0: at-spi2-core-async-session-register.patch
BuildRequires: gtk-doc
BuildRequires: meson >= 0.50.0
BuildRequires: pkgconfig