[evince/recent_view_crash_large_comic: 195/195] EvRecentView: fix crash when thumbnail extraction takes too long




commit db035262387a3e127fa088c99e968fe6c4b66714
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 7802c837d..74a97a469 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);
 }
 
@@ -718,7 +720,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]