Fix crash when hiding and showing
This commit is contained in:
parent
8f5831fa11
commit
7fd9a1bba1
37
0001-gtk-Don-t-early-out-of-frame-free-function.patch
Normal file
37
0001-gtk-Don-t-early-out-of-frame-free-function.patch
Normal file
@ -0,0 +1,37 @@
|
||||
From 86863f8ed7823acd7a98cf8e9f5ab979a4b6ab1a Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
|
||||
Date: Sat, 2 Dec 2023 21:19:45 +0100
|
||||
Subject: [PATCH 1/2] gtk: Don't early out of frame free function
|
||||
|
||||
We should clean up all of what should be cleaned up, even if we didn't
|
||||
actually decorate anything. This fixes memory corruption caused by
|
||||
missing the wl_list_remove() call.
|
||||
|
||||
Closes: https://gitlab.freedesktop.org/libdecor/libdecor/-/issues/59
|
||||
---
|
||||
src/plugins/gtk/libdecor-gtk.c | 9 ++-------
|
||||
1 file changed, 2 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/src/plugins/gtk/libdecor-gtk.c b/src/plugins/gtk/libdecor-gtk.c
|
||||
index 9a9bc5e..f15a6ba 100644
|
||||
--- a/src/plugins/gtk/libdecor-gtk.c
|
||||
+++ b/src/plugins/gtk/libdecor-gtk.c
|
||||
@@ -673,13 +673,8 @@ libdecor_plugin_gtk_frame_free(struct libdecor_plugin *plugin,
|
||||
struct libdecor_frame_gtk *frame_gtk =
|
||||
(struct libdecor_frame_gtk *) frame;
|
||||
|
||||
- /* when in SSD mode, frame_gtk->header is not a proper GTK widget */
|
||||
- if (!GTK_IS_WIDGET(frame_gtk->header)) return;
|
||||
- gtk_widget_destroy(frame_gtk->header);
|
||||
- frame_gtk->header = NULL;
|
||||
- if (!GTK_IS_WIDGET(frame_gtk->window)) return;
|
||||
- gtk_widget_destroy(frame_gtk->window);
|
||||
- frame_gtk->window = NULL;
|
||||
+ g_clear_pointer (&frame_gtk->header, gtk_widget_destroy);
|
||||
+ g_clear_pointer (&frame_gtk->window, gtk_widget_destroy);
|
||||
|
||||
free_border_component(&frame_gtk->headerbar);
|
||||
free_border_component(&frame_gtk->shadow);
|
||||
--
|
||||
2.41.0
|
||||
|
||||
34
0002-gtk-Use-g_clear_pointer-in-a-couple-of-places.patch
Normal file
34
0002-gtk-Use-g_clear_pointer-in-a-couple-of-places.patch
Normal file
@ -0,0 +1,34 @@
|
||||
From 394f49b92680620f09438620185f3179a774f903 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
|
||||
Date: Sat, 2 Dec 2023 21:20:45 +0100
|
||||
Subject: [PATCH 2/2] gtk: Use g_clear_pointer() in a couple of places
|
||||
|
||||
We're writing GTK code, so lets use some of the conveniences from glib.
|
||||
---
|
||||
src/plugins/gtk/libdecor-gtk.c | 9 +++------
|
||||
1 file changed, 3 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/src/plugins/gtk/libdecor-gtk.c b/src/plugins/gtk/libdecor-gtk.c
|
||||
index f15a6ba..2c68b2f 100644
|
||||
--- a/src/plugins/gtk/libdecor-gtk.c
|
||||
+++ b/src/plugins/gtk/libdecor-gtk.c
|
||||
@@ -679,13 +679,10 @@ libdecor_plugin_gtk_frame_free(struct libdecor_plugin *plugin,
|
||||
free_border_component(&frame_gtk->headerbar);
|
||||
free_border_component(&frame_gtk->shadow);
|
||||
frame_gtk->shadow_showing = false;
|
||||
- if (frame_gtk->shadow_blur != NULL) {
|
||||
- cairo_surface_destroy(frame_gtk->shadow_blur);
|
||||
- frame_gtk->shadow_blur = NULL;
|
||||
- }
|
||||
|
||||
- free(frame_gtk->title);
|
||||
- frame_gtk->title = NULL;
|
||||
+ g_clear_pointer (&frame_gtk->shadow_blur, cairo_surface_destroy);
|
||||
+
|
||||
+ g_clear_pointer (&frame_gtk->title, free);
|
||||
|
||||
frame_gtk->decoration_type = DECORATION_TYPE_NONE;
|
||||
|
||||
--
|
||||
2.41.0
|
||||
|
||||
@ -1,11 +1,13 @@
|
||||
Name: libdecor
|
||||
Version: 0.2.1
|
||||
Release: 1%{?dist}
|
||||
Release: 2%{?dist}
|
||||
Summary: Wayland client side decoration library
|
||||
|
||||
License: MIT
|
||||
URL: https://gitlab.freedesktop.org/libdecor/libdecor
|
||||
Source: %{url}/-/releases/%{version}/downloads/libdecor-%{version}.tar.xz
|
||||
Patch0: 0001-gtk-Don-t-early-out-of-frame-free-function.patch
|
||||
Patch1: 0002-gtk-Use-g_clear_pointer-in-a-couple-of-places.patch
|
||||
|
||||
BuildRequires: gcc
|
||||
BuildRequires: meson
|
||||
@ -61,6 +63,9 @@ developing applications that use %{name}.
|
||||
|
||||
|
||||
%changelog
|
||||
* Wed Dec 06 2023 Jonas Ådahl <jadahl@redhat.com> - 0.2.1-2
|
||||
- Fix crash when hiding/showing
|
||||
|
||||
* Fri Dec 01 2023 Jonas Ådahl <jadahl@redhat.com> - 0.2.1-1
|
||||
- Bump version to 0.2.1
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user