clarified plugin start/stop;
authorwenzelm
Wed, 22 Jun 2011 21:27:20 +0200
changeset 43513 06951ddfc812
parent 43512 270ce5ff2086
child 43514 45cf8d5e109a
clarified plugin start/stop;
src/Tools/jEdit/src/plugin.scala
--- a/src/Tools/jEdit/src/plugin.scala	Wed Jun 22 20:56:18 2011 +0200
+++ b/src/Tools/jEdit/src/plugin.scala	Wed Jun 22 21:27:20 2011 +0200
@@ -394,13 +394,15 @@
     Isabelle.system.install_fonts()
     Isabelle.session = new Session(Isabelle.system)
     SyntaxUtilities.setStyleExtender(new Token_Markup.Style_Extender(Isabelle.system.symbols))
-    ModeProvider.instance = new Token_Markup.Mode_Provider(ModeProvider.instance)
+    if (ModeProvider.instance.isInstanceOf[ModeProvider])
+      ModeProvider.instance = new Token_Markup.Mode_Provider(ModeProvider.instance)
     Isabelle.session.phase_changed += session_manager
   }
 
   override def stop()
   {
+    Isabelle.session.phase_changed -= session_manager
+    Isabelle.jedit_buffers.foreach(Isabelle.exit_model)
     Isabelle.session.stop()
-    Isabelle.session.phase_changed -= session_manager
   }
 }