app-utils - make gnc-expression-parser responsible for its own cleanup

It already ensured it would initialize on first use.
It can as well register the hooks it needs for its
cleanup directly itself instead of depending on the
module loading system to do so.
pull/611/head
Geert Janssens 6 years ago
parent 43647c7a54
commit 90aa539908

@ -32,6 +32,7 @@
#include "fin_spl_protos.h"
#include "gnc-filepath-utils.h"
#include "gnc-gkeyfile-utils.h"
#include "gnc-hooks.h"
#include "gnc-exp-parser.h"
#include "gnc-ui-util.h"
#include "gnc-locale-utils.h"
@ -107,6 +108,8 @@ gnc_exp_parser_real_init ( gboolean addPredefined )
}
g_free(filename);
}
gnc_hook_add_dangler(HOOK_SHUTDOWN, (GFunc)gnc_exp_parser_shutdown, NULL, NULL);
}
static gboolean
@ -157,6 +160,8 @@ gnc_exp_parser_shutdown (void)
last_gncp_error = NO_ERR;
parser_inited = FALSE;
gnc_hook_run(HOOK_SAVE_OPTIONS, NULL);
}
void

@ -66,13 +66,6 @@ lmod(char * mn)
g_free(form);
}
static void
app_utils_shutdown(void)
{
gnc_exp_parser_shutdown();
gnc_hook_run(HOOK_SAVE_OPTIONS, NULL);
}
extern SCM scm_init_sw_app_utils_module(void);
@ -85,12 +78,6 @@ libgncmod_app_utils_gnc_module_init(int refcount)
lmod("(sw_app_utils)");
lmod("(gnucash app-utils)");
if (refcount == 0)
{
gnc_hook_add_dangler(HOOK_STARTUP, (GFunc)gnc_exp_parser_init, NULL, NULL);
gnc_hook_add_dangler(HOOK_SHUTDOWN, (GFunc)app_utils_shutdown, NULL, NULL);
}
return TRUE;
}

Loading…
Cancel
Save