Fix memory leak with spell checker
- Dont shadow widgets destroy() - Dont bind spell checker to class attribute, this prevents its finalize Fixes #8822
This commit is contained in:
parent
24d939ce41
commit
4ac532c3fa
|
@ -323,7 +323,6 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools):
|
|||
self.set_emoticon_popover()
|
||||
|
||||
# Attach speller
|
||||
self.spell_checker = None
|
||||
self.set_speller()
|
||||
self.conv_textview.tv.show()
|
||||
|
||||
|
@ -454,15 +453,15 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools):
|
|||
if gspell_lang is None:
|
||||
return
|
||||
|
||||
self.spell_checker = Gspell.Checker.new(gspell_lang)
|
||||
spell_checker = Gspell.Checker.new(gspell_lang)
|
||||
spell_buffer = Gspell.TextBuffer.get_from_gtk_text_buffer(
|
||||
self.msg_textview.get_buffer())
|
||||
spell_buffer.set_spell_checker(self.spell_checker)
|
||||
spell_buffer.set_spell_checker(spell_checker)
|
||||
spell_view = Gspell.TextView.get_from_gtk_text_view(self.msg_textview)
|
||||
spell_view.set_inline_spell_checking(False)
|
||||
spell_view.set_enable_language_menu(True)
|
||||
|
||||
self.spell_checker.connect('notify::language', self.on_language_changed)
|
||||
spell_checker.connect('notify::language', self.on_language_changed)
|
||||
|
||||
def get_speller_language(self):
|
||||
per_type = 'contacts'
|
||||
|
|
|
@ -17,8 +17,6 @@
|
|||
# You should have received a copy of the GNU General Public License
|
||||
# along with Gajim. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import gc
|
||||
|
||||
from gi.repository import Gtk
|
||||
from gi.repository import GLib
|
||||
from gi.repository import GObject
|
||||
|
@ -413,9 +411,6 @@ class MessageTextView(Gtk.TextView):
|
|||
self.add_child_at_anchor(image, anchor)
|
||||
buffer_.insert_at_cursor(' ')
|
||||
|
||||
def destroy(self):
|
||||
GLib.idle_add(gc.collect)
|
||||
|
||||
def clear(self, widget=None):
|
||||
"""
|
||||
Clear text in the textview
|
||||
|
|
Loading…
Reference in New Issue