[Xfce4-commits] <midori:master> Create and release script context for --run/ -r only when needed
Christian Dywan
noreply at xfce.org
Fri Jan 29 21:14:04 CET 2010
Updating branch refs/heads/master
to 218a05049c435142689d2b29b7e7618ac37515e7 (commit)
from 9785317a888aea7524a3e89f3fe9d263344503c0 (commit)
commit 218a05049c435142689d2b29b7e7618ac37515e7
Author: Christian Dywan <christian at twotoasts.de>
Date: Fri Jan 29 21:12:14 2010 +0100
Create and release script context for --run/ -r only when needed
midori/main.c | 15 +++++++--------
1 files changed, 7 insertions(+), 8 deletions(-)
diff --git a/midori/main.c b/midori/main.c
index 94402ab..f2f5ecd 100644
--- a/midori/main.c
+++ b/midori/main.c
@@ -1448,24 +1448,24 @@ midori_load_session (gpointer data)
static gint
midori_run_script (const gchar* filename)
{
+ gchar* exception;
+ gchar* script;
+ GError* error;
+
if (!(filename))
{
g_print ("%s - %s\n", _("Midori"), _("No filename specified"));
return 1;
}
- JSGlobalContextRef js_context;
- gchar* exception;
- gchar* script;
- GError* error = NULL;
-
- js_context = JSGlobalContextCreateInGroup (NULL, NULL);
-
+ error = NULL;
if (g_file_get_contents (filename, &script, NULL, &error))
{
+ JSGlobalContextRef js_context = JSGlobalContextCreateInGroup (NULL, NULL);
if (sokoke_js_script_eval (js_context, script, &exception))
exception = NULL;
g_free (script);
+ JSGlobalContextRelease (js_context);
}
else if (error)
{
@@ -1475,7 +1475,6 @@ midori_run_script (const gchar* filename)
else
exception = g_strdup (_("An unknown error occured."));
- JSGlobalContextRelease (js_context);
if (!exception)
return 0;
More information about the Xfce4-commits
mailing list