From 3d1133cdb5a469c00eb172e1148d19350da484c0 Mon Sep 17 00:00:00 2001 From: Dorota Czaplejewicz Date: Thu, 4 Jul 2019 07:48:46 +0000 Subject: [PATCH 1/2] Fix memory corruption due to a wrong assumption --- src/server-context-service.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/server-context-service.c b/src/server-context-service.c index 32e3b078..a3db595c 100644 --- a/src/server-context-service.c +++ b/src/server-context-service.c @@ -373,6 +373,7 @@ server_context_service_real_hide_keyboard (EekboardContextService *_context) gtk_widget_hide (context->window); gtk_container_remove(GTK_CONTAINER(context->window), context->widget); + context->widget = NULL; // When GTK removes the widget, it doesn't just unlink it, but also frees it destroy_window (context); EEKBOARD_CONTEXT_SERVICE_CLASS (server_context_service_parent_class)-> From c3ffe6ab8b074f23b7b400f01ff5f0d3131f672b Mon Sep 17 00:00:00 2001 From: Dorota Czaplejewicz Date: Thu, 4 Jul 2019 08:48:43 +0000 Subject: [PATCH 2/2] visibility: Handle visibility change no-ops --- eekboard/eekboard-context-service.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/eekboard/eekboard-context-service.c b/eekboard/eekboard-context-service.c index 16336818..dce47228 100644 --- a/eekboard/eekboard-context-service.c +++ b/eekboard/eekboard-context-service.c @@ -569,7 +569,9 @@ eekboard_context_service_show_keyboard (EekboardContextService *context) { g_return_if_fail (EEKBOARD_IS_CONTEXT_SERVICE(context)); - EEKBOARD_CONTEXT_SERVICE_GET_CLASS(context)->show_keyboard (context); + if (!context->priv->visible) { + EEKBOARD_CONTEXT_SERVICE_GET_CLASS(context)->show_keyboard (context); + } } void @@ -577,7 +579,9 @@ eekboard_context_service_hide_keyboard (EekboardContextService *context) { g_return_if_fail (EEKBOARD_IS_CONTEXT_SERVICE(context)); - EEKBOARD_CONTEXT_SERVICE_GET_CLASS(context)->hide_keyboard (context); + if (context->priv->visible) { + EEKBOARD_CONTEXT_SERVICE_GET_CLASS(context)->hide_keyboard (context); + } } /**