Commit 00a0422b authored by Cédric Bellegarde's avatar Cédric Bellegarde

Using Gio.Cancellable.reset() is not safe

parent 88276c76
Pipeline #75814 passed with stage
in 14 minutes and 40 seconds
......@@ -203,7 +203,7 @@ class DatabaseAdblock:
version = load(open(EOLIE_DATA_PATH + "/adblock.bin", "rb"))
except:
version = 0
self.__cancellable.reset()
self.__cancellable = Gio.Cancellable.new()
if self.__adblock_mtime - version > self.__UPDATE:
# Update host rules
uris = list(self.__URIS)
......
......@@ -91,7 +91,7 @@ class DatabasePhishing:
version = load(open(EOLIE_DATA_PATH + "/phishing.bin", "rb"))
except:
version = 0
self.__cancellable.reset()
self.__cancellable = Gio.Cancellable.new()
if self.__phishing_mtime - version > self.__UPDATE:
self.__on_load_uri_content(None, False, b"", [self.__URI])
......
......@@ -222,7 +222,7 @@ class SyncWorker:
self.__username = ""
self.__password = ""
self.__session = None
self.__sync_cancellable.reset()
self.__sync_cancellable = Gio.Cancellable()
self.__helper.clear_sync(None)
def stop(self, force=False):
......@@ -493,7 +493,7 @@ class SyncWorker:
"""
Logger.sync_debug("Start syncing")
self.__syncing = True
self.__sync_cancellable.reset()
self.__sync_cancellable = Gio.Cancellable()
try:
self.__mtimes = load(open(EOLIE_DATA_PATH + "/firefox_sync.bin",
"rb"))
......
......@@ -271,7 +271,7 @@ class ImagesPopover(Gtk.Popover):
uris = source.call_finish(result)[0]
except Exception as e:
Logger.error("ImagesPopover::__on_get_images(): %s", e)
self.__cancellable.reset()
self.__cancellable = Gio.Cancellable()
self.__on_load_uri_content(None, False, b"", uris)
def __on_closed(self, popover):
......
......@@ -884,7 +884,7 @@ class ToolbarTitle(Gtk.Bin):
@param popover as Gtk.popover
"""
self.__cancellable.cancel()
self.__cancellable.reset()
self.__cancellable = Gio.Cancellable.new()
self.__completion_model.clear()
webview = self.__window.container.current.webview
if popover == self.__popover:
......@@ -949,7 +949,7 @@ class ToolbarTitle(Gtk.Bin):
task_helper.run(self.__populate_completion, value)
self.__cancellable.cancel()
self.__cancellable.reset()
self.__cancellable = Gio.Cancellable.new()
network = Gio.NetworkMonitor.get_default().get_network_available()
parsed = urlparse(value)
......
......@@ -31,7 +31,6 @@ class WebViewArtwork:
self.__helper = TaskHelper()
self.__cancellable = Gio.Cancellable()
self.__snapshot_id = None
self.__cancellable = Gio.Cancellable()
self.__favicon_db = self.context.get_favicon_database()
self.__favicon_db.connect("favicon-changed", self.__on_favicon_changed)
self.connect("notify::uri", self.__on_uri_changed)
......@@ -44,7 +43,7 @@ class WebViewArtwork:
if self.ephemeral or parsed.scheme not in ["http", "https"]:
return
self.__cancellable.cancel()
self.__cancellable.reset()
self.__cancellable = Gio.Cancellable()
self.__favicon_db.get_favicon(self.uri,
self.__cancellable,
self.__on_get_favicon,
......@@ -60,7 +59,7 @@ class WebViewArtwork:
if self.ephemeral or parsed.scheme not in ["http", "https"]:
return
self.__cancellable.cancel()
self.__cancellable.reset()
self.__cancellable = Gio.Cancellable()
self.__favicon_db.get_favicon(self.uri,
self.__cancellable,
self.__on_get_favicon,
......@@ -78,7 +77,7 @@ class WebViewArtwork:
"""
if event == WebKit2.LoadEvent.STARTED:
self.__cancellable.cancel()
self.__cancellable.reset()
self.__cancellable = Gio.Cancellable()
if self.__snapshot_id is not None:
GLib.source_remove(self.__snapshot_id)
self.__snapshot_id = None
......
......@@ -198,7 +198,7 @@ class WebViewSignals(WebViewMenuSignals, WebViewJsSignals,
self.__title_changed_timeout_id = GLib.timeout_add(
2000, title_changed_timeout)
self.__cancellable.cancel()
self.__cancellable.reset()
self.__cancellable = Gio.Cancellable()
self._readable = False
def __on_title_changed(self, webview, title):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment