OSDN Git Service

Win: Random crash on double-clicking the document file is fixed.
authorToshi Nagata <alchemist.2005@nifty.com>
Sun, 19 Dec 2021 10:20:28 +0000 (19:20 +0900)
committerToshi Nagata <alchemist.2005@nifty.com>
Sun, 19 Dec 2021 10:20:28 +0000 (19:20 +0900)
Makefile
wxSources/MyApp.cpp
wxSources/MyApp.h
wxSources/MyIPCSupport.cpp
wxSources/MyIPCSupport.h

index d44fb1a..7116652 100755 (executable)
--- a/Makefile
+++ b/Makefile
@@ -167,9 +167,6 @@ ifeq ($(TARGET_PLATFORM),MSW)
        cp -r ../Documents/MolbyDoc $(DESTPREFIX)/$(PRODUCT_DIR)
        mkdir -p $(DESTPREFIX)/$(PRODUCT_DIR)/Scripts/lib
        for i in $(RUBY_EXTLIB); do cp $(RUBY_DIR)/lib/$$i $(DESTPREFIX)/$(PRODUCT_DIR)/Scripts/lib; done
-ifneq ($(DEBUG),1)
-       for i in $(DESTPREFIX)/$(PRODUCT_DIR)/*.exe $(DESTPREFIX)/$(PRODUCT_DIR)/amber11/bin/*.exe $(DESTPREFIX)/$(PRODUCT_DIR)/ortep3/*.exe; do $(TOOL_PREFIX)strip "$$i"; done
-endif
 endif
 
 ifeq ($(TARGET_PLATFORM),MSW)
@@ -177,6 +174,9 @@ ifneq ($(DEBUG),1)
 install: setup
 
 setup: $(DESTPREFIX) $(DESTPREFIX)/$(PRODUCT_DIR)/$(FINAL_EXECUTABLE)
+ifneq ($(DEBUG),1)
+       for i in $(DESTPREFIX)/$(PRODUCT_DIR)/*.exe $(DESTPREFIX)/$(PRODUCT_DIR)/amber11/bin/*.exe $(DESTPREFIX)/$(PRODUCT_DIR)/ortep3/*.exe; do $(TOOL_PREFIX)strip "$$i"; done
+endif
        mkdir -p ../latest_binaries
 ifneq ($(WINE_PATH),)
        ($(WINE_PATH)/wine ../../Inno\ Setup\ 5/ISCC.exe molby$(PRODUCT_SUFFIX).iss || exit 1)
index e985652..2f7575e 100755 (executable)
@@ -1719,6 +1719,34 @@ MyApp::OnHelp(wxCommandEvent& WXUNUSED(event) )
     wxLaunchDefaultBrowser(wxT("file:///") + url);
 }
 
+int
+MyApp::FilterEvent(wxEvent &event)
+{
+#if 0
+    static FILE *fp_eventlog = NULL;
+    if (fp_eventlog == NULL) {
+        char buf[32];
+        int i = 0;
+        while (1) {
+            snprintf(buf, sizeof buf, "Molby_eventlog_%d.log", i);
+            fp_eventlog = fopen(buf, "r");
+            if (fp_eventlog == NULL) {
+                fp_eventlog = fopen(buf, "wt");
+                break;
+            } else {
+                fclose(fp_eventlog);
+                i++;
+            }
+        }
+    }
+    if (fp_eventlog != NULL) {
+        fprintf(fp_eventlog, "%d %d\n", event.GetEventType(), event.GetId());
+        }
+        fflush(fp_eventlog);
+    }
+#endif
+    return -1;
+}
 
 #pragma mark ====== AboutBox ======
 
index 77c94d0..5bd00f4 100755 (executable)
@@ -237,6 +237,8 @@ class MyApp: public wxApp
 
     void OnHelp(wxCommandEvent& event);
 
+    int FilterEvent(wxEvent &event);
+
 protected:
     MyDocManager* m_docManager;
        wxProgressDialog *m_progressDialog;
index d413356..ba83945 100755 (executable)
@@ -33,7 +33,7 @@ wxString *gIPCServiceName = NULL;
 bool
 MyClientConnection::OnDisconnect()
 {
-       wxGetApp().m_client->Disconnect();
+       return wxGetApp().m_client->Disconnect();
 }
 
 MyClient::MyClient()
@@ -46,13 +46,15 @@ MyClient::~MyClient()
        Disconnect();
 }
        
-void
+bool
 MyClient::Disconnect()
 {
        if (m_clientConnection != NULL) {
-               m_clientConnection->Disconnect();
-               m_clientConnection = NULL;
-       }
+        if (m_clientConnection->Disconnect()) {
+            m_clientConnection = NULL;
+            return true;
+        } else return false;
+    } else return true;
 }
 
 wxConnectionBase *
@@ -66,7 +68,7 @@ MyClient::OnMakeConnection()
 bool
 MyServerConnection::OnDisconnect()
 {
-       wxGetApp().m_server->Disconnect();
+       return wxGetApp().m_server->Disconnect();
 }
 
 bool
@@ -89,13 +91,15 @@ MyServer::~MyServer()
        Disconnect();
 }
 
-void
+bool
 MyServer::Disconnect()
 {
        if (m_serverConnection != NULL) {
-               m_serverConnection->Disconnect();
-               m_serverConnection = NULL;
-       }
+        if (m_serverConnection->Disconnect()) {
+            m_serverConnection = NULL;
+            return true;
+        } else return false;
+    } else return true;
 }
 
 wxConnectionBase *
index eddb67f..14424fc 100755 (executable)
@@ -37,7 +37,7 @@ class MyClient: public wxClient
 public:
        MyClient();
        ~MyClient();
-       void Disconnect();
+       bool Disconnect();
     wxConnectionBase *OnMakeConnection();
        MyClientConnection *m_clientConnection;
 };
@@ -54,7 +54,7 @@ class MyServer: public wxServer
 public:
        MyServer();
        ~MyServer();
-       void Disconnect();
+       bool Disconnect();
     wxConnectionBase *OnAcceptConnection(const wxString& topic);
        MyServerConnection *m_serverConnection;
 };