diff options
author | Lucas Fryzek <lucas.fryzek@fryzekconcepts.com> | 2024-10-06 22:22:03 +0100 |
---|---|---|
committer | Lucas Fryzek <lucas.fryzek@fryzekconcepts.com> | 2024-10-06 22:22:03 +0100 |
commit | 4ddbd0142fec70c8c9575d6f2f9b5ef93a93bd90 (patch) | |
tree | 1def62234d534d2f9d884adbb02b3ae926fb8467 /src/main.py | |
parent | b6ff088fcaee86f1518bf0e77a478638af50aa32 (diff) |
chat,main: Fix client crashes on Fedora version of Gtk4
Diffstat (limited to 'src/main.py')
-rw-r--r-- | src/main.py | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/main.py b/src/main.py index 53206be..5334516 100644 --- a/src/main.py +++ b/src/main.py @@ -50,6 +50,10 @@ class WeegtkApplication(Adw.Application): self.network.connect("message_from_weechat", self._network_weechat_msg) self.buffers = [] + # We need to keep track of buffer pages because some versions of Gtk + # crash. I believe its related to this: + # https://gitlab.gnome.org/GNOME/gtk/-/issues/5917 + self.pages = [] conf = config.read() if config.str_to_bool(conf["relay"]["autoconnect"]): @@ -66,8 +70,15 @@ class WeegtkApplication(Adw.Application): conf["relay"]["password"]) def clear_buffers(self): for buffer in self.buffers: - self.props.active_window.stack.remove(buffer) + res = self.props.active_window.stack.remove(buffer) self.buffers = [] + self.pages = [] + + def remove_buffer(self, index): + buf = self.buffers[index] + self.props.active_window.stack.remove(buf) + self.buffers.pop(index) + self.pages.pop(index) def disconnect(self, *args): self.network.disconnect_weechat() @@ -339,6 +350,7 @@ class WeegtkApplication(Adw.Application): page = self.props.active_window.stack.add_titled(buf, name=buf_name, title=buf_name) if buf.data["full_name"] == "core.weechat": self.props.active_window.set_page(page) + self.pages.insert(index, page) def buffer_input(self, source_object, full_name, text): if self.network.is_connected(): |