From 41fc16fba91bf5bacddc18c20a3298fc193c631d Mon Sep 17 00:00:00 2001 From: Slava Zanko Date: Thu, 24 Sep 2009 02:31:49 +0300 Subject: [PATCH] [PATCH] Add init and deinit of event system. Signed-off-by: Slava Zanko --- src/main.c | 7 +++++++ src/widget.c | 2 ++ 2 files changed, 9 insertions(+) diff --git a/src/main.c b/src/main.c index 65195b817..47bf61957 100644 --- a/src/main.c +++ b/src/main.c @@ -78,6 +78,7 @@ #include "command.h" #include "wtools.h" #include "cmddef.h" /* CK_ cmd name const */ +#include "../src/event/event.h" #include "../vfs/vfs.h" /* vfs_translate_url() */ @@ -1113,6 +1114,7 @@ init_xterm_support (void) termvalue = getenv ("TERM"); if (!termvalue || !(*termvalue)) { fputs (_("The TERM environment variable is unset!\n"), stderr); + mc_event_deinit(); exit (1); } @@ -1811,6 +1813,7 @@ mc_main__setup_by_args(int argc, char *argv[]) view_one_file = g_strdup (tmp); else { fputs ("No arguments given to the viewer\n", stderr); + mc_event_deinit(); exit (1); } } else { @@ -1839,6 +1842,9 @@ main (int argc, char *argv[]) bindtextdomain ("mc", LOCALEDIR); textdomain ("mc"); + /* we need for event system berofe any other functions calls */ + mc_event_init(); + /* Set up temporary directory */ mc_tmpdir (); @@ -1996,6 +2002,7 @@ main (int argc, char *argv[]) #ifdef USE_INTERNAL_EDIT edit_stack_free (); #endif + mc_event_deinit(); return 0; } diff --git a/src/widget.c b/src/widget.c index 2c2bd9c23..0a07d9730 100644 --- a/src/widget.c +++ b/src/widget.c @@ -53,6 +53,7 @@ #include "widget.h" #include "wtools.h" #include "strutil.h" +#include "../src/event/event.h" #include "cmddef.h" /* CK_ cmd name const */ #include "keybind.h" /* global_key_map_t */ @@ -1165,6 +1166,7 @@ input_destroy (WInput *in) { if (!in){ fprintf (stderr, "Internal error: null Input *\n"); + mc_event_deinit(); exit (1); }