Plug a few memory leaks in MidoriView and MidoriWebSettings

This commit is contained in:
Christian Dywan 2009-05-14 22:26:02 +02:00
parent 05f403bd54
commit 03a6f54d25
2 changed files with 22 additions and 4 deletions

View file

@ -539,7 +539,10 @@ midori_view_update_icon (MidoriView* view,
{ {
icon_theme = gtk_icon_theme_get_for_screen (screen); icon_theme = gtk_icon_theme_get_for_screen (screen);
if ((parts = g_strsplit (view->mime_type, "/", 2))) if ((parts = g_strsplit (view->mime_type, "/", 2)))
parts = (parts[0] && parts[1]) ? parts : NULL; {
if (!(parts[0] && parts[1]))
katze_assign (parts, NULL);
}
} }
else else
parts = NULL; parts = NULL;
@ -780,8 +783,8 @@ webkit_web_view_load_finished_cb (WebKitWebView* web_view,
g_strfreev (parts); g_strfreev (parts);
} }
g_strfreev (items); g_strfreev (items);
g_object_set_data (G_OBJECT (view), "news-feeds", g_object_set_data_full (G_OBJECT (view), "news-feeds",
value && *value ? (void*)1 : (void*)0); value && *value ? (void*)1 : (void*)0, g_free);
/* Ensure load-status is notified again, whether it changed or not */ /* Ensure load-status is notified again, whether it changed or not */
g_object_notify (G_OBJECT (view), "load-status"); g_object_notify (G_OBJECT (view), "load-status");
} }

View file

@ -954,7 +954,7 @@ notify_default_encoding_cb (GObject* object,
GParamSpec* pspec) GParamSpec* pspec)
{ {
MidoriWebSettings* web_settings; MidoriWebSettings* web_settings;
const gchar* string; gchar* string;
const gchar* encoding; const gchar* encoding;
web_settings = MIDORI_WEB_SETTINGS (object); web_settings = MIDORI_WEB_SETTINGS (object);
@ -973,6 +973,7 @@ notify_default_encoding_cb (GObject* object,
web_settings->preferred_encoding = MIDORI_ENCODING_WESTERN; web_settings->preferred_encoding = MIDORI_ENCODING_WESTERN;
else else
web_settings->preferred_encoding = MIDORI_ENCODING_CUSTOM; web_settings->preferred_encoding = MIDORI_ENCODING_CUSTOM;
g_free (string);
g_object_notify (object, "preferred-encoding"); g_object_notify (object, "preferred-encoding");
} }
@ -994,6 +995,20 @@ midori_web_settings_init (MidoriWebSettings* web_settings)
static void static void
midori_web_settings_finalize (GObject* object) midori_web_settings_finalize (GObject* object)
{ {
MidoriWebSettings* web_settings;
web_settings = MIDORI_WEB_SETTINGS (object);
katze_assign (web_settings->toolbar_items, NULL);
katze_assign (web_settings->homepage, NULL);
katze_assign (web_settings->download_folder, NULL);
katze_assign (web_settings->download_manager, NULL);
katze_assign (web_settings->text_editor, NULL);
katze_assign (web_settings->news_aggregator, NULL);
katze_assign (web_settings->location_entry_search, NULL);
katze_assign (web_settings->http_proxy, NULL);
katze_assign (web_settings->ident_string, NULL);
G_OBJECT_CLASS (midori_web_settings_parent_class)->finalize (object); G_OBJECT_CLASS (midori_web_settings_parent_class)->finalize (object);
} }