1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
|
From e86c32092e693ecffcec211133fd1929603948d1 Mon Sep 17 00:00:00 2001
From: Adam Williamson <awilliam@redhat.com>
Date: Sat, 30 Nov 2024 14:59:49 -0800
Subject: [PATCH] revert override of connection.register_object
This seems to break the exit handler of anaconda (Fedora/RHEL
installer), such that it often fails to exit properly.
Signed-off-by: Adam Williamson <awilliam@redhat.com>
---
gi/overrides/Gio.py | 31 -------------------
tests/test_gdbus.py | 73 ---------------------------------------------
2 files changed, 104 deletions(-)
diff --git a/gi/overrides/Gio.py b/gi/overrides/Gio.py
index 48c3737a..45256385 100644
--- a/gi/overrides/Gio.py
+++ b/gi/overrides/Gio.py
@@ -89,37 +89,6 @@ class DBusArgInfo(Gio.DBusArgInfo):
__all__.append('DBusArgInfo')
-@override
-class DBusConnection(Gio.DBusConnection):
- __init__ = _warn_init(Gio.DBusConnection)
-
- def register_object(self,
- object_path,
- interface_info,
- method_call_closure=None,
- get_property_closure=None,
- set_property_closure=None):
- if method_call_closure is not None:
- def wrapped_method_call_closure(connection, sender, object_path,
- interface_name, method_name, parameters,
- invocation):
- method_call_closure(connection, sender, object_path,
- interface_name, method_name, parameters,
- invocation)
- invocation._unref()
- else:
- wrapped_method_call_closure = None
-
- return super().register_object(object_path,
- interface_info,
- wrapped_method_call_closure,
- get_property_closure,
- set_property_closure)
-
-
-__all__.append('DBusConnection')
-
-
@override
class DBusMethodInfo(Gio.DBusMethodInfo):
__init__ = _warn_init(Gio.DBusMethodInfo)
diff --git a/tests/test_gdbus.py b/tests/test_gdbus.py
index afbf94cb..18fd0e41 100644
--- a/tests/test_gdbus.py
+++ b/tests/test_gdbus.py
@@ -284,76 +284,3 @@ class TestDBusConnection:
):
reg_id = bus.register_object(**kwargs)
bus.unregister_object(reg_id)
-
- @unittest.skipUnless(has_dbus, "no dbus running")
- def test_connection_invocation_ref_count(self):
- """Invocation object should not leak a reference."""
- invocation, errors = self.run_server(self.client_call)
-
- assert not errors
- assert invocation
- assert invocation.ref_count == 1
-
- def run_server(self, client_callback):
- self.invocation = None
- self.errors = []
- self.loop = GLib.MainLoop()
-
- def on_name_acquired(bus, name):
- client_callback(bus)
-
- self.reg_id = None
- bus = Gio.bus_get_sync(Gio.BusType.SESSION)
- owner_id = Gio.bus_own_name(Gio.BusType.SESSION,
- "org.pygobject.Test",
- Gio.BusNameOwnerFlags.NONE,
- self.on_bus_acquired,
- on_name_acquired,
- self.on_name_lost)
- try:
- self.loop.run()
- finally:
- Gio.bus_unown_name(owner_id)
- if self.reg_id:
- bus.unregister_object(self.reg_id)
-
- return (self.invocation, self.errors)
-
- def on_name_lost(self, _bus, name):
- self.errors.append(f"Name {name} lost")
- self.loop.quit()
-
- def on_bus_acquired(self, bus, name):
- interface_xml = """
- <node>
- <interface name='org.pygobject.Test'>
- <method name='test' />
- </interface>
- </node>"""
- self.reg_id = bus.register_object("/pygobject/Test",
- Gio.DBusNodeInfo.new_for_xml(interface_xml).interfaces[0],
- self.on_incoming_method_call,
- None,
- None)
-
- def on_incoming_method_call(self, bus, sender, object_path, interface_name, method_name, parameters, invocation):
- invocation.return_value(GLib.Variant("()", ()))
- self.invocation = invocation
-
- def client_call(self, bus):
-
- def call_done(obj, result):
- try:
- obj.call_finish(result)
- finally:
- self.loop.quit()
-
- bus.call("org.pygobject.Test",
- "/pygobject/Test",
- "org.pygobject.Test",
- "test",
- parameters=None,
- reply_type=None,
- flags=Gio.DBusCallFlags.NONE,
- timeout_msec=5000,
- callback=call_done)
--
2.47.0
|