svnno****@sourc*****
svnno****@sourc*****
Fri Sep 11 12:37:20 JST 2009
Revision: 3843 http://sourceforge.jp/projects/kazehakase/svn/view?view=rev&revision=3843 Author: ikezoe Date: 2009-09-11 12:37:20 +0900 (Fri, 11 Sep 2009) Log Message: ----------- * src/kz-app.c: Free non-object variables in finalize. Modified Paths: -------------- kazehakase/trunk/ChangeLog kazehakase/trunk/src/kz-app.c Modified: kazehakase/trunk/ChangeLog =================================================================== --- kazehakase/trunk/ChangeLog 2009-09-11 03:37:19 UTC (rev 3842) +++ kazehakase/trunk/ChangeLog 2009-09-11 03:37:20 UTC (rev 3843) @@ -6,6 +6,7 @@ * src/kz-xml.c: Add kz_xml_attr_new. * src/bookmarks/kz-bookmark.c: Remove dispose. * src/bookmarks/kz-xbel.c: Use ternary operator. + * src/kz-app.c: Free non-object variables in finalize. 2009-09-10 Hiroyuki Ikezoe <poinc****@ikezo*****> Modified: kazehakase/trunk/src/kz-app.c =================================================================== --- kazehakase/trunk/src/kz-app.c 2009-09-11 03:37:19 UTC (rev 3842) +++ kazehakase/trunk/src/kz-app.c 2009-09-11 03:37:20 UTC (rev 3843) @@ -122,6 +122,7 @@ guint n_props, GObjectConstructParam *props); static void dispose (GObject *object); +static void finalize (GObject *object); static void set_property (GObject *object, guint prop_id, const GValue *value, @@ -158,6 +159,7 @@ object_class->constructor = constructor; object_class->dispose = dispose; + object_class->finalize = finalize; object_class->set_property = set_property; object_class->get_property = get_property; @@ -377,31 +379,6 @@ g_free(priv->system_ext_dir); g_free(priv->system_ruby_ext_dir); g_free(priv->system_ruby_ext_data_dir); - - priv->user_dir = NULL; - priv->history_dir = NULL; - priv->history_time_stamp = NULL; - priv->popup_dir = NULL; - priv->favicon_dir = NULL; - priv->smartbookmark_history_dir = NULL; - priv->form_data_dir = NULL; - priv->clips_dir = NULL; - priv->thumbnails_dir = NULL; - - priv->system_data_dir = NULL; - priv->system_kz_data_dir = NULL; - priv->system_lib_dir = NULL; - priv->system_config_dir = NULL; - - priv->system_icons_dir = NULL; - priv->system_pixmaps_dir = NULL; - - priv->system_embed_module_dir = NULL; - priv->system_search_module_dir = NULL; - - priv->system_ext_dir = NULL; - priv->system_ruby_ext_dir = NULL; - priv->system_ruby_ext_data_dir = NULL; } #define DEFINE_PATH_GETTER(name) \ @@ -565,6 +542,40 @@ static void dispose (GObject *object) { + KzAppPrivate *priv = KZ_APP_GET_PRIVATE(object); + + if (priv->bookmarks) + { + kz_root_bookmark_save_all(priv->bookmarks); + g_object_unref(priv->bookmarks); + priv->bookmarks = NULL; + } + + if (priv->profile) + { + kz_profile_close(priv->profile); + priv->profile = NULL; + } + + if (priv->proxy) + { + kz_profile_close(priv->proxy); + priv->proxy = NULL; + } + + if (priv->favicon) + { + g_object_unref(priv->favicon); + priv->favicon = NULL; + } + + if (G_OBJECT_CLASS (kz_app_parent_class)->dispose) + G_OBJECT_CLASS (kz_app_parent_class)->dispose(object); +} + +static void +finalize (GObject *object) +{ gchar *accel_prefs_file; KzAppPrivate *priv = KZ_APP_GET_PRIVATE(object); @@ -576,28 +587,13 @@ gtk_accel_map_save(accel_prefs_file); g_free(accel_prefs_file); - kz_root_bookmark_save_all(priv->bookmarks); - g_object_unref(priv->bookmarks); - - kz_profile_close(priv->profile); - kz_profile_close(priv->proxy); - - if (priv->favicon) - g_object_unref(priv->favicon); - - if (priv->argv) - g_strfreev(priv->argv); - #ifdef USE_SSL gnutls_global_deinit(); #endif #ifdef USE_MIGEMO if (priv->migemo) - { kz_migemo_free(priv->migemo); - priv->migemo = NULL; - } #endif #ifdef HAVE_LIBSM @@ -605,16 +601,11 @@ SmcCloseConnection ((SmcConn) priv->smc_conn, 0, NULL); #endif /* HAVE_LIBSM */ - priv->profile = NULL; - priv->proxy = NULL; - priv->bookmarks = NULL; - priv->favicon = NULL; - priv->argv = NULL; - + g_strfreev(priv->argv); kz_app_dispose_path(object); - if (G_OBJECT_CLASS (kz_app_parent_class)->dispose) - G_OBJECT_CLASS (kz_app_parent_class)->dispose(object); + if (G_OBJECT_CLASS (kz_app_parent_class)->finalize) + G_OBJECT_CLASS (kz_app_parent_class)->finalize(object); } KzApp *