Control: retitle -1 gnome-shell: crashes on screen lock
Control: tag -1 + patch upstream

Hi,

On Thu, May 07, 2020 at 10:15:22AM -0300, Antonio Terceiro wrote:
> On Wed, May 06, 2020 at 08:40:47PM +0100, Simon McVittie wrote:
> > On Wed, 06 May 2020 at 15:21:30 -0300, Antonio Terceiro wrote:
> > > The actual core dump is 19MB compresses, is it useful?
> > 
> > Not particularly, because I probably don't have precisely the same
> > versions of libraries that you do. I might need to ask you to install
> > -dbgsym packages and get a backtrace with `coredumpctl gdb` if we can't
> > work out what's going on any other way.
> > 
> > >                 Stack trace of thread 86099:
> > >                 #0  0x00007f5b6079408d __strncmp_avx2 (libc.so.6 + 
> > > 0x15a08d)
> > >                 #1  0x00007f5b61481f9d g_str_has_prefix (libglib-2.0.so.0 
> > > + 0x71f9d)
> > >                 #2  0x00007f5b605df475 _st_theme_node_ensure_background 
> > > (libst-1.0.so + 0x39475)
> > >                 #3  0x00007f5b605e31a5 st_theme_node_paint_equal 
> > > (libst-1.0.so + 0x3d1a5)
> > >                 #4  0x00007f5b605edc73 n/a (libst-1.0.so + 0x47c73)
> > >                 #5  0x00007f5b605edfc3 st_widget_style_changed 
> > > (libst-1.0.so + 0x47fc3)
> > 
> > This looks like it could be
> > <https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2709>. If so, there's
> > a fix in upstream git (not uploaded to Debian yet).
> 
> ack. I discovered I can reproduce this by simply pressing Super+L ("lock
> screen").
> 
> I may try the upstream fix locally to see it if helps.

I just built a local package by cherry picking commit
118676bffb44eac5e8caff159c2306e7bef4deba from the gnome-3-36 branch in
the upstream repo, and confirm it does fix the issue for me.

I'm attaching the patch in case anyone else is affected and wants a
quick fix.
From 3ed033000e04ecb2f5e48489aec579385b7205f9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jonas=20Dre=C3=9Fler?= <ver...@v0yd.nl>
Date: Thu, 30 Apr 2020 20:23:52 +0000
Subject: [PATCH] st/theme: Unref CRStylesheet after removing old theme nodes

Since we now remove all theme nodes on a stylesheet change (ie.
StTheme's "custom-stylesheets-changed" signal) instead of only
invalidating them, those nodes may not be accessed anymore as soon as
"custom-stylesheets-changed" is emitted.

It turned out though that when comparing them to the newly generated
nodes in `st_widget_recompute_style()` using the
`st_theme_node_paint/geometry_equal()` functions, the properties of the
old nodes will still be accessed, causing a crash since the
CRDeclarations are already freed.

To fix that, keep the reference to the CRStylesheet, which owns the
CRDeclarations used by the theme nodes, around a bit longer, so it's
still possible to access the CRDeclarations inside the
"custom-stylesheets-changed" signal handler. This allows us to compare
the old theme nodes to the new ones since the CSS properties of both are
still valid.

Fixes https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2709


(cherry picked from commit e06109c23ce2a6dd53d32c26a89ab46a952d7373)
---
 src/st/st-theme.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/st/st-theme.c b/src/st/st-theme.c
index 0d2d2eeac..7ccf7b5ba 100644
--- a/src/st/st-theme.c
+++ b/src/st/st-theme.c
@@ -287,8 +287,10 @@ st_theme_unload_stylesheet (StTheme    *theme,
   theme->custom_stylesheets = g_slist_remove (theme->custom_stylesheets, stylesheet);
   g_hash_table_remove (theme->stylesheets_by_file, file);
   g_hash_table_remove (theme->files_by_stylesheet, stylesheet);
-  cr_stylesheet_unref (stylesheet);
+
   g_signal_emit (theme, signals[STYLESHEETS_CHANGED], 0);
+
+  cr_stylesheet_unref (stylesheet);
 }
 
 /**
-- 
2.26.2

Attachment: signature.asc
Description: PGP signature

Reply via email to