more robust shutdown, e.g. when plugin is stopped;
authorwenzelm
Sun, 20 Aug 2017 18:30:20 +0200
changeset 66458 42d0d5c77c78
parent 66457 9098c36abd1a
child 66459 b578ef1a8b40
more robust shutdown, e.g. when plugin is stopped;
src/Tools/jEdit/src/jedit_editor.scala
src/Tools/jEdit/src/plugin.scala
--- a/src/Tools/jEdit/src/jedit_editor.scala	Sun Aug 20 14:03:23 2017 +0200
+++ b/src/Tools/jEdit/src/jedit_editor.scala	Sun Aug 20 18:30:20 2017 +0200
@@ -39,6 +39,13 @@
   def invoke(): Unit = delay1_flush.invoke()
   def invoke_generated(): Unit = { delay1_flush.invoke(); delay2_flush.invoke() }
 
+  def shutdown(): Unit =
+    GUI_Thread.require {
+      delay1_flush.revoke()
+      delay2_flush.revoke()
+      Document_Model.flush_edits(hidden = false, purge = false)
+    }
+
   def visible_node(name: Document.Node.Name): Boolean =
     (for {
       text_area <- JEdit_Lib.jedit_text_areas()
--- a/src/Tools/jEdit/src/plugin.scala	Sun Aug 20 14:03:23 2017 +0200
+++ b/src/Tools/jEdit/src/plugin.scala	Sun Aug 20 18:30:20 2017 +0200
@@ -211,7 +211,7 @@
       GUI_Thread.later {
         delay_load.revoke()
         delay_init.revoke()
-        PIDE.editor.flush()
+        PIDE.editor.shutdown()
         exit_models(JEdit_Lib.jedit_buffers().toList)
       }
 
@@ -454,5 +454,6 @@
     exit_models(JEdit_Lib.jedit_buffers().toList)
     session.stop()
     file_watcher.shutdown()
+    PIDE.editor.shutdown()
   }
 }