more robust Isabelle_System.init (amending c0bc99aad936): avoid non-termination on Windows (java.lang.StackOverflowError);
authorwenzelm
Thu, 23 Apr 2020 13:49:46 +0200
changeset 71792 936718dede80
parent 71791 bb72e75cec61
child 71793 e771b8157fc7
more robust Isabelle_System.init (amending c0bc99aad936): avoid non-termination on Windows (java.lang.StackOverflowError);
src/Pure/System/isabelle_system.scala
--- a/src/Pure/System/isabelle_system.scala	Thu Apr 23 13:23:04 2020 +0200
+++ b/src/Pure/System/isabelle_system.scala	Thu Apr 23 13:49:46 2020 +0200
@@ -51,23 +51,21 @@
   @volatile private var _settings: Option[Map[String, String]] = None
   @volatile private var _services: Option[List[Service]] = None
 
-  private def uninitialized: Boolean = _services.isEmpty   // unsynchronized check
-
   def settings(): Map[String, String] =
   {
-    if (uninitialized) init()
+    if (_settings.isEmpty) init()  // unsynchronized check
     _settings.get
   }
 
   def services(): List[Service] =
   {
-    if (uninitialized) init()
+    if (_services.isEmpty) init()  // unsynchronized check
     _services.get
   }
 
   def init(isabelle_root: String = "", cygwin_root: String = ""): Unit = synchronized
   {
-    if (uninitialized) {
+    if (_settings.isEmpty || _services.isEmpty) {
       val isabelle_root1 =
         bootstrap_directory(isabelle_root, "ISABELLE_ROOT", "isabelle.root", "Isabelle root")