Commit 56b59020 authored by Sébastien Wilmet's avatar Sébastien Wilmet

DocumentStructure: remove idle GSource when object destroyed

To try to fix:
#57

But it doesn't fix the crash.
parent 21051fce
......@@ -59,6 +59,8 @@ public class DocumentStructure : GLib.Object
private static string[] _section_names = null;
private uint _idle_id = 0;
public bool parsing_done { get; private set; default = false; }
public DocumentStructure (Document doc)
......@@ -87,6 +89,15 @@ public class DocumentStructure : GLib.Object
}
}
~DocumentStructure ()
{
if (_idle_id != 0)
{
Source.remove (_idle_id);
_idle_id = 0;
}
}
public void parse ()
{
// reset
......@@ -98,9 +109,17 @@ public class DocumentStructure : GLib.Object
_end_document_mark = null;
clear_all_structure_marks ();
Idle.add (() =>
if (_idle_id != 0)
Source.remove (_idle_id);
_idle_id = Idle.add (() =>
{
return parse_impl ();
bool ret = parse_impl ();
if (!ret)
_idle_id = 0;
return ret;
});
}
......
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