OSDN Git Service

Avoid opening files during execution of other Ruby script
authorToshi Nagata <alchemist.2005@nifty.com>
Fri, 11 Feb 2022 05:47:58 +0000 (14:47 +0900)
committerToshi Nagata <alchemist.2005@nifty.com>
Fri, 11 Feb 2022 05:47:58 +0000 (14:47 +0900)
MolLib/Ruby_bind/Molby.h
MolLib/Ruby_bind/Molby_extern.h
wxSources/MyApp.cpp

index 5d74452..c227202 100755 (executable)
@@ -45,8 +45,6 @@ extern VALUE Ruby_DecrementInterruptLevel(VALUE dummy); */
 extern VALUE Ruby_DisableInterrupt(VALUE dummy); */
 
 /*  Flag to avoid multiple running ruby interpreter  */
-extern int gMolbyRunLevel;
-extern int gMolbyIsCheckingInterrupt;
 extern VALUE gMolbyBacktrace;
 
 extern VALUE Ruby_CallMethodWithInterrupt(VALUE receiver, ID method_id, VALUE args, int *status);
index b67effa..a4896c8 100755 (executable)
@@ -30,6 +30,9 @@ typedef void *RubyValue;
 #define RubyNil ((RubyValue)4)
 #endif
 
+extern int gMolbyRunLevel;
+extern int gMolbyIsCheckingInterrupt;
+
 extern int gSuppressConsole;
 extern int gUseGUI;
     
index 408f1bc..90f3962 100755 (executable)
@@ -1257,6 +1257,11 @@ MyApp::OnActivate(wxActivateEvent &event)
 void
 MyApp::RequestOpenFilesByEvent(wxString& files)
 {
+    /*  We do not respond to "open file" event (either via IPC [MSW] or Apple Event [Mac])
+        while we are running something else  */
+    if (m_progressDialog != NULL || gMolbyIsCheckingInterrupt || gMolbyRunLevel > 0)
+        return;
+
        if (m_pendingFilesToOpen != NULL)
                m_pendingFilesToOpen->Append(files);
        else