[PATCH] Add init and deinit of event system.

Signed-off-by: Slava Zanko <slavazanko@gmail.com>
This commit is contained in:
Slava Zanko 2009-09-24 02:31:49 +03:00
parent 0021e2465a
commit 41fc16fba9
2 changed files with 9 additions and 0 deletions

View File

@ -78,6 +78,7 @@
#include "command.h" #include "command.h"
#include "wtools.h" #include "wtools.h"
#include "cmddef.h" /* CK_ cmd name const */ #include "cmddef.h" /* CK_ cmd name const */
#include "../src/event/event.h"
#include "../vfs/vfs.h" /* vfs_translate_url() */ #include "../vfs/vfs.h" /* vfs_translate_url() */
@ -1113,6 +1114,7 @@ init_xterm_support (void)
termvalue = getenv ("TERM"); termvalue = getenv ("TERM");
if (!termvalue || !(*termvalue)) { if (!termvalue || !(*termvalue)) {
fputs (_("The TERM environment variable is unset!\n"), stderr); fputs (_("The TERM environment variable is unset!\n"), stderr);
mc_event_deinit();
exit (1); exit (1);
} }
@ -1811,6 +1813,7 @@ mc_main__setup_by_args(int argc, char *argv[])
view_one_file = g_strdup (tmp); view_one_file = g_strdup (tmp);
else { else {
fputs ("No arguments given to the viewer\n", stderr); fputs ("No arguments given to the viewer\n", stderr);
mc_event_deinit();
exit (1); exit (1);
} }
} else { } else {
@ -1839,6 +1842,9 @@ main (int argc, char *argv[])
bindtextdomain ("mc", LOCALEDIR); bindtextdomain ("mc", LOCALEDIR);
textdomain ("mc"); textdomain ("mc");
/* we need for event system berofe any other functions calls */
mc_event_init();
/* Set up temporary directory */ /* Set up temporary directory */
mc_tmpdir (); mc_tmpdir ();
@ -1996,6 +2002,7 @@ main (int argc, char *argv[])
#ifdef USE_INTERNAL_EDIT #ifdef USE_INTERNAL_EDIT
edit_stack_free (); edit_stack_free ();
#endif #endif
mc_event_deinit();
return 0; return 0;
} }

View File

@ -53,6 +53,7 @@
#include "widget.h" #include "widget.h"
#include "wtools.h" #include "wtools.h"
#include "strutil.h" #include "strutil.h"
#include "../src/event/event.h"
#include "cmddef.h" /* CK_ cmd name const */ #include "cmddef.h" /* CK_ cmd name const */
#include "keybind.h" /* global_key_map_t */ #include "keybind.h" /* global_key_map_t */
@ -1165,6 +1166,7 @@ input_destroy (WInput *in)
{ {
if (!in){ if (!in){
fprintf (stderr, "Internal error: null Input *\n"); fprintf (stderr, "Internal error: null Input *\n");
mc_event_deinit();
exit (1); exit (1);
} }