[Xfce4-commits] r29520 - in libxfce4menu/trunk: . libxfce4menu
Jannis Pohlmann
jannis at xfce.org
Fri Feb 20 18:15:49 CET 2009
Author: jannis
Date: 2009-02-20 17:15:49 +0000 (Fri, 20 Feb 2009)
New Revision: 29520
Modified:
libxfce4menu/trunk/ChangeLog
libxfce4menu/trunk/libxfce4menu/xfce-menu-item-cache.c
libxfce4menu/trunk/libxfce4menu/xfce-menu.c
Log:
* libxfce4menu/xfce-menu-item-cache.c: Deactivate all the TDB related
code because it's not used anyway. Don't increase the reference
count on new menu items in xfce_menu_item_cache_lookup() as this
causes increasing memory leaks. Patch by David Mohr (bug #3812).
* libxfce4menu/xfce-menu.c: Fix typo in the installation of the
"deleted" property of XfceMenu. Patch by David Mohr.
Modified: libxfce4menu/trunk/ChangeLog
===================================================================
--- libxfce4menu/trunk/ChangeLog 2009-02-20 12:37:26 UTC (rev 29519)
+++ libxfce4menu/trunk/ChangeLog 2009-02-20 17:15:49 UTC (rev 29520)
@@ -1,3 +1,12 @@
+2009-02-20 Jannis Pohlmann <jannis at xfce.org>
+
+ * libxfce4menu/xfce-menu-item-cache.c: Deactivate all the TDB related
+ code because it's not used anyway. Don't increase the reference
+ count on new menu items in xfce_menu_item_cache_lookup() as this
+ causes increasing memory leaks. Patch by David Mohr (bug #3812).
+ * libxfce4menu/xfce-menu.c: Fix typo in the installation of the
+ "deleted" property of XfceMenu. Patch by David Mohr.
+
2009-02-17 Jannis Pohlmann <jannis at xfce.org>
* NEWS: Update NEWS.
Modified: libxfce4menu/trunk/libxfce4menu/xfce-menu-item-cache.c
===================================================================
--- libxfce4menu/trunk/libxfce4menu/xfce-menu-item-cache.c 2009-02-20 12:37:26 UTC (rev 29519)
+++ libxfce4menu/trunk/libxfce4menu/xfce-menu-item-cache.c 2009-02-20 17:15:49 UTC (rev 29520)
@@ -61,7 +61,7 @@
static void xfce_menu_item_cache_class_init (XfceMenuItemCacheClass *klass);
static void xfce_menu_item_cache_init (XfceMenuItemCache *cache);
static void xfce_menu_item_cache_finalize (GObject *object);
-#if 1 /* ITEM CACHE DEACTIVATED FOR NOW */
+#if 0 /* ITEM CACHE DEACTIVATED FOR NOW */
static XfceMenuItem *xfce_menu_item_cache_fetch_item (XfceMenuItemCache *cache,
const gchar *filename);
static void xfce_menu_item_cache_store_item (XfceMenuItemCache *cache,
@@ -108,9 +108,11 @@
/* Hash table for mapping absolute filenames to XfceMenuItem's */
GHashTable *items;
+#if 0
/* TDB context */
TDB_CONTEXT *context;
TDB_DATA data;
+#endif
/* Mutex lock */
GMutex *lock;
@@ -178,7 +180,9 @@
static void
xfce_menu_item_cache_init (XfceMenuItemCache *cache)
{
+#if 0 /* ITEM CACHE DEACTIVATED FOR NOW */
gchar *path;
+#endif
cache->priv = XFCE_MENU_ITEM_CACHE_GET_PRIVATE (cache);
@@ -188,6 +192,7 @@
/* Create empty hash table */
cache->priv->items = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, (GDestroyNotify) xfce_menu_item_unref);
+#if 0 /* ITEM CACHE DEACTIVATED FOR NOW */
/* Determine path to the item cache file */
path = xfce_resource_save_location (XFCE_RESOURCE_CACHE, "libxfce4menu/items.tdb", TRUE);
@@ -209,6 +214,7 @@
/* Release the path */
g_free (path);
+#endif
}
@@ -233,9 +239,11 @@
g_hash_table_destroy (cache->priv->items);
#endif
+#if 0 /* MENU ITEM CACHE DEACTIVATED FOR NOW */
/* Close TDB database */
if (G_LIKELY (cache->priv->context != NULL))
tdb_close (cache->priv->context);
+#endif
/* Release mutex lock */
g_mutex_free (cache->priv->lock);
@@ -261,7 +269,6 @@
* item cache */
g_mutex_lock (cache->priv->lock);
-#if 1
/* Search filename in the hash table */
item = g_hash_table_lookup (cache->priv->items, filename);
@@ -271,10 +278,10 @@
/* Update desktop id, if necessary */
xfce_menu_item_set_desktop_id (item, desktop_id);
- /* TODO Check OnlyShowIn / NotShowIn values */
-
+#if 0
/* Store updated item in cache */
xfce_menu_item_cache_store_item (cache, filename, item);
+#endif
/* Release item cache lock */
g_mutex_unlock (cache->priv->lock);
@@ -282,6 +289,7 @@
return item;
}
+#if 0
/* Otherwise, search in the item cache */
if (G_LIKELY (cache->priv->context != NULL))
{
@@ -323,18 +331,19 @@
/* Update desktop id */
xfce_menu_item_set_desktop_id (item, desktop_id);
-#if 1 /* ITEM CACHE DEACTIVATED FOR NOW */
+#if 0 /* ITEM CACHE DEACTIVATED FOR NOW */
/* Store updated item in cache */
xfce_menu_item_cache_store_item (cache, filename, item);
+#endif
/* The file has been loaded, add the item to the hash table */
g_hash_table_replace (cache->priv->items, g_strdup (filename), item);
-#endif
- /* Grab a reference on it but don't increase the allocation counter */
-#if 1
- g_object_ref (G_OBJECT (item));
-#endif
+ /* We do _not_ want to increase the reference count here, since the
+ * menu item was just created, and already comes with a reference
+ * count of 1. Whenever it will be stored again (i.e. in the pool),
+ * then its reference count will be increased again at the time
+ * of that event. */
}
/* Release item cache lock */
@@ -363,7 +372,7 @@
-#if 1 /* ITEM CACHE DEACTIVATED FOR NOW */
+#if 0 /* ITEM CACHE DEACTIVATED FOR NOW */
static XfceMenuItem*
xfce_menu_item_cache_fetch_item (XfceMenuItemCache *cache,
const gchar *filename)
Modified: libxfce4menu/trunk/libxfce4menu/xfce-menu.c
===================================================================
--- libxfce4menu/trunk/libxfce4menu/xfce-menu.c 2009-02-20 12:37:26 UTC (rev 29519)
+++ libxfce4menu/trunk/libxfce4menu/xfce-menu.c 2009-02-20 17:15:49 UTC (rev 29520)
@@ -509,7 +509,7 @@
* Whether this menu should be ignored.
**/
g_object_class_install_property (gobject_class,
- PROP_ONLY_UNALLOCATED,
+ PROP_DELETED,
g_param_spec_boolean ("deleted",
"Deleted",
"Whether this menu should be ignored",
More information about the Xfce4-commits
mailing list