[evince/gnome-40] EvRecentView: fix crash when thumbnail extraction takes too long



commit 42f937c2ee400218df64f2a0869608fe34614e1c
Author: Nelson Benítez León <nbenitezl gmail com>
Date:   Fri Jan 21 21:05:10 2022 -0400

    EvRecentView: fix crash when thumbnail extraction takes too long
    
    When opening a large file for the first time from the recent
    view, evince launches a background process to extract and save
    the thumbnail of the first page, this process can take several
    seconds for big documents (like comic files).
    
    So it can happen that when it finished extracting the thumbnail
    the EvRecentView has already been destroyed (to show document
    view) and so when the "save thumbnail" code tries to access
    the recent view it crashes.
    
    Fixed by refing the view when attaching it to async process
    and unrefing it in its corresponding free_data callback.
    
    Fixes issue #965

 shell/ev-recent-view.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
---
diff --git a/shell/ev-recent-view.c b/shell/ev-recent-view.c
index 7a426d370..ff5b6f1aa 100644
--- a/shell/ev-recent-view.c
+++ b/shell/ev-recent-view.c
@@ -109,6 +109,8 @@ get_document_info_async_data_free (GetDocumentInfoAsyncData *data)
         }
         gtk_tree_row_reference_free (data->row);
 
+        g_object_unref (data->ev_recent_view);
+
         g_slice_free (GetDocumentInfoAsyncData, data);
 }
 
@@ -720,7 +722,7 @@ ev_recent_view_get_document_info (EvRecentView  *ev_recent_view,
        EvRecentViewPrivate *priv = GET_PRIVATE (ev_recent_view);
 
         data = g_slice_new0 (GetDocumentInfoAsyncData);
-        data->ev_recent_view = ev_recent_view;
+        data->ev_recent_view = g_object_ref (ev_recent_view);
         data->uri = g_strdup (uri);
         data->row = gtk_tree_row_reference_new (GTK_TREE_MODEL (priv->model), path);;
         data->cancellable = g_cancellable_new ();


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