[libgda/LIBGDA_4.2] GdaSql: really exit on ".q" command, removed warning
- From: Vivien Malerba <vivien src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgda/LIBGDA_4.2] GdaSql: really exit on ".q" command, removed warning
- Date: Wed, 18 Jan 2012 17:45:55 +0000 (UTC)
commit e19675cecfe92bdebc2cdc6af5cb1d3409e38b45
Author: Vivien Malerba <malerba gnome-db org>
Date: Sun Jan 8 20:54:11 2012 +0100
GdaSql: really exit on ".q" command, removed warning
tools/gda-sql.c | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/tools/gda-sql.c b/tools/gda-sql.c
index 34462f5..c867ae5 100644
--- a/tools/gda-sql.c
+++ b/tools/gda-sql.c
@@ -133,6 +133,7 @@ typedef struct {
MainData *main_data;
GString *prompt = NULL;
GMainLoop *main_loop = NULL;
+gboolean exit_requested = FALSE;
static ConnectionSetting *get_current_connection_settings (SqlConsole *console);
static char **completion_func (const char *text, int start, int end);
@@ -413,6 +414,9 @@ main (int argc, char *argv[])
}
}
+ if (exit_requested)
+ goto cleanup;
+
/* set up interactive commands */
setup_sigint_handler ();
init_input ((TreatLineFunc) treat_line_func, prompt_func, NULL);
@@ -513,6 +517,7 @@ treat_line_func (const gchar *cmde, gboolean *out_cmde_exec_ok)
display_result (res);
if (res->type == GDA_INTERNAL_COMMAND_RESULT_EXIT) {
gda_internal_command_exec_result_free (res);
+ exit_requested = TRUE;
goto exit;
}
gda_internal_command_exec_result_free (res);
@@ -529,7 +534,8 @@ treat_line_func (const gchar *cmde, gboolean *out_cmde_exec_ok)
exit:
g_free (loc_cmde);
- g_main_loop_quit (main_loop);
+ if (main_loop)
+ g_main_loop_quit (main_loop);
return FALSE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]