[pango/misc-speedups] pango-view: Avoid an assertion when running headless
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pango/misc-speedups] pango-view: Avoid an assertion when running headless
- Date: Mon, 29 Mar 2021 16:57:42 +0000 (UTC)
commit 798db5f1ed54a913081a10d268e11c12df711cb5
Author: Matthias Clasen <mclasen redhat com>
Date: Mon Mar 29 12:55:41 2021 -0400
pango-view: Avoid an assertion when running headless
The cairo debug cleanup function asserts that all cairo
resources have been released, but with PangoFcFontMap
now doing work in threads, some of those threads may
still be active, holding a reference to the fontmap,
and thereby keeping cairo objects alive. To fix this
without giving up on the cleanup entirely, use a
weak notify to defer it until the fontmap is going
away.
utils/viewer-pangocairo.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/utils/viewer-pangocairo.c b/utils/viewer-pangocairo.c
index ac3b49c3..ff9314a1 100644
--- a/utils/viewer-pangocairo.c
+++ b/utils/viewer-pangocairo.c
@@ -79,6 +79,13 @@ pangocairo_view_create (const PangoViewer *klass G_GNUC_UNUSED)
return instance;
}
+static void
+clear_cairo_data (gpointer data,
+ GObject *dead)
+{
+ cairo_debug_reset_static_data ();
+}
+
static void
pangocairo_view_destroy (gpointer instance)
{
@@ -86,12 +93,12 @@ pangocairo_view_destroy (gpointer instance)
cairo_font_options_destroy (c->font_options);
+ g_object_weak_ref (G_OBJECT (c->fontmap), clear_cairo_data, NULL);
+
g_object_unref (c->fontmap);
c->iface->backend_class->destroy (c->backend);
- cairo_debug_reset_static_data ();
-
g_slice_free (CairoViewer, c);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]