changeset 26841:b6dfe7d192bc stable

fix creating keyword files for editor autocompletion (bug #55835) * file-editor-tab.cc (update_lexer_settings): for testing whether qscintilla can open the files, try to open it readonly and if not existing, create path and try to open it writeonly
author Torsten <mttl@mailbox.org>
date Tue, 05 Mar 2019 21:06:51 +0100
parents b00bd9afbed3
children 603f5d6ada56 11e7037bed01
files libgui/src/m-editor/file-editor-tab.cc
diffstat 1 files changed, 9 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libgui/src/m-editor/file-editor-tab.cc	Tue Mar 05 09:31:20 2019 +0100
+++ b/libgui/src/m-editor/file-editor-tab.cc	Tue Mar 05 21:06:51 2019 +0100
@@ -698,9 +698,16 @@
 
           }
 
-        // make sure the apis file is usable
+        // Make sure the apis file is usable, otherwise the gui might crash,
+        // e.g., in case of max. number of opened files
         QFile f (_prep_apis_file);
-        bool apis_usable = f.open (QIODevice::ReadWrite);
+
+        bool apis_usable = f.open (QIODevice::ReadOnly);
+        if (! apis_usable)
+          {
+            QDir ().mkpath (QFileInfo (f).absolutePath ());
+            apis_usable = f.open (QIODevice::WriteOnly);
+          }
         if (apis_usable)
           f.close ();