summaryrefslogtreecommitdiff
path: root/gi/overrides/GLib.py
diff options
context:
space:
mode:
Diffstat (limited to 'gi/overrides/GLib.py')
-rw-r--r--gi/overrides/GLib.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/gi/overrides/GLib.py b/gi/overrides/GLib.py
index 78d309b6..0425d50f 100644
--- a/gi/overrides/GLib.py
+++ b/gi/overrides/GLib.py
@@ -525,12 +525,16 @@ class Source(GLib.Source):
def __del__(self):
if hasattr(self, '__pygi_custom_source'):
+ # We destroy and finalize the box from here, as GLib might hold
+ # a reference (e.g. while the source is pending), delaying the
+ # finalize call until a later point.
self.destroy()
- # XXX: We have to unref the underlying source while the Python
- # wrapper is still valid, so the source can call into the
- # wrapper methods for the finalized callback.
+ self.finalize()
self._clear_boxed()
+ def finalize(self):
+ pass
+
def set_callback(self, fn, user_data=None):
if hasattr(self, '__pygi_custom_source'):
# use our custom pygi_source_set_callback() if for a GSource object