Fix crashes on screen blank in some dual-monitor configurations

Closes: #894388
This commit is contained in:
Simon McVittie
2018-04-03 08:29:41 +01:00
parent c6ecc02bb8
commit 63492e5199
3 changed files with 57 additions and 0 deletions

3
debian/changelog vendored
View File

@ -8,6 +8,9 @@ gtk+3.0 (3.22.29-3) UNRELEASED; urgency=medium
d/p/0015-m4macros-Fix-underquoting-in-AC_PATH_TOOL.patch:
Use AC_PATH_TOOL to find pkg-config in the deprecated AM_PATH_GTK_3_0
macro (Closes: #894069)
* d/p/0016-imwayland-destroy-objects-only-if-it-matches-our-man.patch:
Add patch proposed upstream to fix crashes on screen blank in some
dual-monitor configurations (Closes: #894388)
-- Simon McVittie <smcv@debian.org> Thu, 22 Mar 2018 15:47:57 +0000

View File

@ -0,0 +1,53 @@
From: Lionel Landwerlin <llandwerlin@gmail.com>
Date: Tue, 27 Mar 2018 19:42:43 +0100
Subject: imwayland: destroy objects only if it matches our manager object
Should fix one of the crash from #129.
Bug: https://gitlab.gnome.org/GNOME/gtk/issues/129
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=894388
Forwarded: https://gitlab.gnome.org/GNOME/gtk/merge_requests/89
Applied-upstream: no
---
modules/input/imwayland.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/modules/input/imwayland.c b/modules/input/imwayland.c
index 30d2536..89b2f7a 100644
--- a/modules/input/imwayland.c
+++ b/modules/input/imwayland.c
@@ -35,6 +35,7 @@ struct _GtkIMContextWaylandGlobal
{
struct wl_display *display;
struct wl_registry *registry;
+ uint32_t text_input_manager_wl_id;
struct gtk_text_input_manager *text_input_manager;
struct gtk_text_input *text_input;
uint32_t enter_serial;
@@ -205,8 +206,9 @@ registry_handle_global (void *data,
if (strcmp (interface, "gtk_text_input_manager") == 0)
{
+ global->text_input_manager_wl_id = id;
global->text_input_manager =
- wl_registry_bind (global->registry, id,
+ wl_registry_bind (global->registry, global->text_input_manager_wl_id,
&gtk_text_input_manager_interface, 1);
global->text_input =
gtk_text_input_manager_get_text_input (global->text_input_manager,
@@ -223,11 +225,11 @@ registry_handle_global_remove (void *data,
{
GtkIMContextWaylandGlobal *global = data;
- gtk_text_input_destroy (global->text_input);
- global->text_input = NULL;
+ if (id != global->text_input_manager_wl_id)
+ return;
- gtk_text_input_manager_destroy (global->text_input_manager);
- global->text_input_manager = NULL;
+ g_clear_pointer(&global->text_input, gtk_text_input_destroy);
+ g_clear_pointer(&global->text_input_manager, gtk_text_input_manager_destroy);
}
static const struct wl_registry_listener registry_listener = {

View File

@ -13,3 +13,4 @@ gdk-x11-Check-if-we-have-access-to-GL-before-using-G.patch
0013-wayland-Drop-cairo-surfaces-when-withdrawing.patch
0014-AM_PATH_GTK_3_0-Use-AC_PATH_TOOL-to-find-pkg-config.patch
0015-m4macros-Fix-underquoting-in-AC_PATH_TOOL.patch
0016-imwayland-destroy-objects-only-if-it-matches-our-man.patch