[Xfce4-commits] <midori:master> Rebuild formhistory script on reload and do not leak the script

Christian Dywan noreply at xfce.org
Tue Feb 2 21:34:02 CET 2010


Updating branch refs/heads/master
         to ce43fb3c03b72547eca6104362b90c60ab1d4cfb (commit)
       from 62dac745d69a4dec938bc8e16502c0bc37d668cf (commit)

commit ce43fb3c03b72547eca6104362b90c60ab1d4cfb
Author: Alexander Butenko <a.butenka at gmail.com>
Date:   Tue Feb 2 21:31:15 2010 +0100

    Rebuild formhistory script on reload and do not leak the script
    
    1. Don't leak the script in formhistory_window_object_cleared_cb ()
    2. Disconnect add-tab signal in the right place
    3. Rebuild the base javascript code on extension reload

 extensions/formhistory.c |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/extensions/formhistory.c b/extensions/formhistory.c
index 8404ea1..6c1548e 100644
--- a/extensions/formhistory.c
+++ b/extensions/formhistory.c
@@ -291,7 +291,10 @@ formhistory_window_object_cleared_cb (WebKitWebView*  web_view,
                                       JSContextRef    js_context,
                                       JSObjectRef     js_window)
 {
-    sokoke_js_script_eval (js_context, formhistory_build_js (), NULL);
+    gchar* script;
+    script = formhistory_build_js ();
+    sokoke_js_script_eval (js_context, script, NULL);
+    g_free (script);
 }
 
 static void
@@ -343,8 +346,6 @@ formhistory_deactivate_tabs (MidoriView*      view,
 {
     GtkWidget* web_view = gtk_bin_get_child (GTK_BIN (view));
     g_signal_handlers_disconnect_by_func (
-       browser, formhistory_add_tab_cb, extension);
-    g_signal_handlers_disconnect_by_func (
        web_view, formhistory_window_object_cleared_cb, NULL);
     #if WEBKIT_CHECK_VERSION (1, 1, 4)
     g_signal_handlers_disconnect_by_func (
@@ -365,13 +366,15 @@ formhistory_deactivate_cb (MidoriExtension* extension,
     #endif
 
     g_signal_handlers_disconnect_by_func (
+       browser, formhistory_add_tab_cb, extension);
+    g_signal_handlers_disconnect_by_func (
         extension, formhistory_deactivate_cb, browser);
     g_signal_handlers_disconnect_by_func (
         app, formhistory_app_add_browser_cb, extension);
     midori_browser_foreach (browser,
         (GtkCallback)formhistory_deactivate_tabs, extension);
 
-    jsforms = "";
+    katze_assign (jsforms, NULL);
     if (global_keys)
         g_hash_table_destroy (global_keys);
 
@@ -428,6 +431,8 @@ formhistory_activate_cb (MidoriExtension* extension,
     global_keys = g_hash_table_new_full (g_str_hash, g_str_equal,
                                (GDestroyNotify)g_free,
                                (GDestroyNotify)g_free);
+    if(!jsforms)
+        formhistory_prepare_js ();
     #if HAVE_SQLITE
     config_dir = midori_extension_get_config_dir (extension);
     katze_mkdir_with_parents (config_dir, 0700);



More information about the Xfce4-commits mailing list