[evince/wip/chpe/fix-critial: 11/11] libview: Fix critial warnings when destroying EvPageAccessible




commit c2c24b68da1ae9c90b0b4c891a825fe10302eeae
Author: Christian Persch <chpe src gnome org>
Date:   Tue Nov 16 23:54:17 2021 +0100

    libview: Fix critial warnings when destroying EvPageAccessible
    
    Only clear priv->links when it's not NULL. This fixes lots of warnings
    when closing the previewer window on a document with links:
    
    GLib-CRITICAL **: 23:46:34.810: g_hash_table_remove_all: assertion 'hash_table != NULL' failed
    GLib-CRITICAL **: 23:46:34.810: g_hash_table_destroy: assertion 'hash_table != NULL' failed

 libview/ev-page-accessible.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
---
diff --git a/libview/ev-page-accessible.c b/libview/ev-page-accessible.c
index ece1ff6ec..ed246d4b1 100644
--- a/libview/ev-page-accessible.c
+++ b/libview/ev-page-accessible.c
@@ -170,9 +170,7 @@ ev_page_accessible_finalize (GObject *object)
 {
        EvPageAccessiblePrivate *priv = EV_PAGE_ACCESSIBLE (object)->priv;
 
-       g_hash_table_remove_all (priv->links);
-       g_hash_table_destroy (priv->links);
-       priv->links = NULL;
+        g_clear_pointer (&priv->links, g_hash_table_destroy);
        clear_children (EV_PAGE_ACCESSIBLE (object));
 
        G_OBJECT_CLASS (ev_page_accessible_parent_class)->finalize (object);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]