[pygobject/benzea/gio-asyncio] finalize GSource via box clearing
- From: Benjamin Berg <bberg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pygobject/benzea/gio-asyncio] finalize GSource via box clearing
- Date: Thu, 28 Oct 2021 08:57:58 +0000 (UTC)
commit 92af016bf8da3f8ea96fcf38b4f55694b3c1d5a7
Author: Benjamin Berg <bberg redhat com>
Date: Thu Oct 28 10:46:50 2021 +0200
finalize GSource via box clearing
gi/events.py | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/gi/events.py b/gi/events.py
index 11a58f51..51e91388 100644
--- a/gi/events.py
+++ b/gi/events.py
@@ -145,6 +145,7 @@ class EventLoop(asyncio.SelectorEventLoop):
source.set_callback(self._signal_cb, sig)
self.__signal_handlers[sig] = (source, callback, args)
+ del source
def remove_signal_handler(self, sig):
if sig not in { signal.SIGHUP, signal.SIGINT, signal.SIGTERM, signal.SIGUSR1, signal.SIGUSR2,
signal.SIGWINCH }:
@@ -152,11 +153,10 @@ class EventLoop(asyncio.SelectorEventLoop):
try:
source, _, _ = self.__signal_handlers[sig]
- source.destroy()
- # Make sure the GSource is finalized
- source.set_callback(None)
- del source
del self.__signal_handlers[sig]
+ # Really unref the underlying GSource so that GLib resets the signal handler
+ source.destroy()
+ source._clear_boxed()
# GLib does not restore the original signal handler.
# Try to restore the python handler for SIGINT, this makes
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]