From c263989e44c4a6449787552ece3de72303dd1818 Mon Sep 17 00:00:00 2001 From: Rr42 Date: Fri, 29 Jun 2018 19:41:09 +0530 Subject: Patch: Fixes bug where the save dialog cancel button did not work. --- ldmicro/ldmicro.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/ldmicro/ldmicro.cpp b/ldmicro/ldmicro.cpp index 700e490..cfd25da 100644 --- a/ldmicro/ldmicro.cpp +++ b/ldmicro/ldmicro.cpp @@ -66,7 +66,7 @@ char CurrentCompileFile[MAX_PATH]; PlcProgram Prog; /// Function to safely quit program gtk main loop -void LD_WM_Close_call(GtkWidget *widget, GdkEvent *event, gpointer user_data); +gboolean LD_WM_Close_call(GtkWidget *widget, GdkEvent *event, gpointer user_data); //----------------------------------------------------------------------------- // Get a filename with a common dialog box and then save the program to that @@ -699,13 +699,14 @@ gboolean LD_WM_KeyDown_call(GtkWidget *widget, GdkEventKey *event, gpointer user return FALSE; } -void LD_WM_Close_call(GtkWidget *widget, GdkEvent *event, gpointer user_data) +gboolean LD_WM_Close_call(GtkWidget *widget, GdkEvent *event, gpointer user_data) { /* Handles: * WM_CLOSE */ - CheckSaveUserCancels(); + if(CheckSaveUserCancels()) + return TRUE; FreezeWindowPos(MainWindow); FreezeDWORD(IoListHeight); @@ -881,13 +882,15 @@ void LD_WM_Destroy_call(GtkWidget *widget, GdkEvent *event, gpointer user_data) /* Handles: * WM_DESTROY */ - + g_print("destroy called\n"); CheckSaveUserCancels(); + return; FreezeWindowPos(MainWindow); FreezeDWORD(IoListHeight); gtk_main_quit(); + gdk_threads_leave(); } gboolean LD_WM_Size_call(GtkWidget *widget, GdkEvent *event, gpointer user_data) @@ -1342,6 +1345,5 @@ int main(int argc, char** argv) // } gtk_main(); - gdk_threads_leave(); return EXIT_SUCCESS; } \ No newline at end of file -- cgit