[epiphany/mcatanzaro/cancellables: 9/10] snapshot-service: use cancellable, or ref, where required



commit 2596422316cf6519a6622daa3a00566b0abc99b6
Author: Michael Catanzaro <mcatanzaro gnome org>
Date:   Mon Dec 16 18:53:02 2019 -0600

    snapshot-service: use cancellable, or ref, where required
    
    We have one async function call here that doesn't strictly require a
    cancellable, as long as we ensure the EphySnapshotService doesn't die
    before it finishes.

 lib/ephy-snapshot-service.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/lib/ephy-snapshot-service.c b/lib/ephy-snapshot-service.c
index e1e21aeca..a8a06b5ae 100644
--- a/lib/ephy-snapshot-service.c
+++ b/lib/ephy-snapshot-service.c
@@ -456,7 +456,8 @@ retrieve_snapshot_from_web_view (GTask *task)
   webkit_web_view_get_snapshot (data->web_view,
                                 WEBKIT_SNAPSHOT_REGION_VISIBLE,
                                 WEBKIT_SNAPSHOT_OPTIONS_NONE,
-                                NULL, (GAsyncReadyCallback)on_snapshot_ready,
+                                g_task_get_cancellable (task),
+                                (GAsyncReadyCallback)on_snapshot_ready,
                                 task);
   return FALSE;
 }
@@ -746,13 +747,15 @@ got_snapshot_path_to_delete_cb (EphySnapshotService *service,
   if (path)
     unlink (path);
   g_free (path);
+
+  g_object_unref (service);
 }
 
 void
 ephy_snapshot_service_delete_snapshot_for_url (EphySnapshotService *service,
                                                const char          *url)
 {
-  ephy_snapshot_service_get_snapshot_path_for_url_async (service,
+  ephy_snapshot_service_get_snapshot_path_for_url_async (g_object_ref (service),
                                                          url,
                                                          NULL,
                                                          (GAsyncReadyCallback)got_snapshot_path_to_delete_cb,


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