Commit 812d99d8 authored by Christian Hergert's avatar Christian Hergert

html-preview: fix leak of IdeEditorView

The html-preview plugin was creating lambda's which held
references to the various widgetry. These are apparently causing
leaks. Probably something to be worked out in PyGObject but
easier for us to just stop using lambda's when possible.
parent 05cfd174
......@@ -198,7 +198,7 @@ class HtmlPreviewAddin(GObject.Object, Ide.EditorViewAddin):
group = view.get_action_group('editor-view')
self.action = Gio.SimpleAction(name='preview-as-html', enabled=True)
self.action.connect('activate', lambda *_: self.preview_activated(view))
self.action.connect('activate', self.preview_activated)
group.add_action(self.action)
document = view.get_buffer()
......@@ -253,9 +253,12 @@ class HtmlPreviewAddin(GObject.Object, Ide.EditorViewAddin):
return sphinx_builddir
def preview_activated(self, view):
def preview_activated(self):
global can_preview_rst
if self.view is None:
return
if self.lang_id == 'rst':
if self.sphinx_basedir:
if not can_preview_sphinx:
......@@ -282,9 +285,9 @@ class HtmlPreviewAddin(GObject.Object, Ide.EditorViewAddin):
column.add(web_view)
self.action.set_enabled(False)
web_view.connect('destroy', lambda *_: self.web_view_destroyed(web_view))
web_view.connect('destroy', self.web_view_destroyed)
def web_view_destroyed(self, web_view):
def web_view_destroyed(self, web_view, *args):
self.action.set_enabled(True)
def search_sphinx_base_dir(self, path):
......
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