Daniel Brötzmann pushed to branch master at gajim / gajim


Commits:
b95cd715 by wurstsalat at 2025-01-29T22:14:20+01:00
cfix: CodeTextView: Prevent leak by disabling line numbers

The left gutter renderer (line numbers) creates a leak

- - - - -
65cd5601 by wurstsalat at 2025-01-29T22:14:20+01:00
cfix: ConversationView: Reset listbox without recreating it

- - - - -
523bfb59 by wurstsalat at 2025-01-29T22:14:20+01:00
fix: ChatStack: Fix leak with Previews when switching to another workspace

This leak would only show when clear() is called, since show_chat() already 
implements
app.preview_manager.clear_previews()

- - - - -


3 changed files:

- gajim/gtk/chat_stack.py
- gajim/gtk/conversation/code_widget.py
- gajim/gtk/conversation/view.py


Changes:

=====================================
gajim/gtk/chat_stack.py
=====================================
@@ -857,6 +857,8 @@ def clear(self) -> None:
         if self._current_contact is not None:
             self._current_contact.disconnect_all_from_obj(self)
 
+        app.preview_manager.clear_previews()
+
         self._last_quoted_id = None
         self.set_visible_child_name("empty")
         self._chat_banner.clear()


=====================================
gajim/gtk/conversation/code_widget.py
=====================================
@@ -130,6 +130,5 @@ def get_code(self) -> str:
         return buffer_.get_text(start, end, False)
 
     def print_code(self, code: str) -> None:
-        self.set_show_line_numbers(True)
         buffer_ = self.get_buffer()
         buffer_.insert(buffer_.get_start_iter(), code)


=====================================
gajim/gtk/conversation/view.py
=====================================
@@ -238,17 +238,12 @@ def _emit(self, signal_name: str, *args: Any) -> None:
             GLib.idle_add(self.emit, signal_name, *args)
 
     def _reset_list_box(self) -> None:
-        # TODO GTK4
-        # self._list_box.destroy()
-        self._list_box = Gtk.ListBox()
         self._list_box.set_selection_mode(Gtk.SelectionMode.NONE)
-        self._list_box.set_sort_func(self._sort_func)
-        self._list_box.show()
+        # Performance: Disable sort function before removing all rows
+        self._list_box.set_sort_func(None)
+        self._list_box.remove_all()
 
-        current_child = self.get_child()
-        assert current_child is not None
-        # current_child.destroy()
-        self.set_child(self._list_box)
+        self._list_box.set_sort_func(self._sort_func)
 
     def _reset(self) -> None:
         self._current_upper = 0



View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/compare/f8a10e4c0c60e9adedac3c2666fca49d3e0affe1...523bfb59af598cb759791f5e7a5c973d251cf1b7

-- 
View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/compare/f8a10e4c0c60e9adedac3c2666fca49d3e0affe1...523bfb59af598cb759791f5e7a5c973d251cf1b7
You're receiving this email because of your account on dev.gajim.org.


_______________________________________________
Commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to