Commit 53d6c8c2 authored by Daniel Brötzmann's avatar Daniel Brötzmann

MessageInputTextView: Fix GTK warning when closing chat control

Fixes #10146
parent 1cb58072
Pipeline #6302 passed with stages
in 4 minutes and 27 seconds
......@@ -18,6 +18,7 @@
# along with Gajim. If not, see <http://www.gnu.org/licenses/>.
from gi.repository import Gtk
from gi.repository import Gdk
from gi.repository import GLib
from gi.repository import GObject
from gi.repository import Pango
......@@ -108,6 +109,18 @@ class MessageInputTextView(Gtk.TextView):
self.connect('focus-in-event', self._on_grab_focus)
self.connect('grab-focus', self._on_grab_focus)
self.connect('focus-out-event', self._on_focus_out)
self.connect('destroy', self._on_destroy)
def _on_destroy(self, *args):
# We restore the TextView’s drag destination to avoid a GTK warning
# when closing the control. ChatControlBase.shutdown() calls destroy()
# on the control’s main box, causing GTK to recursively destroy the
# child widgets. GTK then tries to set a target list on the TextView,
# resulting in a warning because the Widget has no drag destination.
self.drag_dest_set(
Gtk.DestDefaults.ALL,
None,
Gdk.DragAction.DEFAULT)
def _on_buffer_changed(self, *args):
text = self.get_text()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment