Re: [Tracker] Merging Turtle branch to Trunk



On Tue, 2008-12-09 at 18:32 +0100, Philip Van Hoof wrote:
 
-     g_hash_table_insert (metadata->table,
-                          g_object_ref (field),
-                          data);
+     g_hash_table_replace (metadata->table,
+                           g_object_ref (field),
+                           data);
+

## If you don't use _replace here then the GHashTable wont exec the
## GDestroyNotify. This means that you always leak the reference
## per each time that you add a string to a list-element.

No, _insert will not leak. The only difference between _insert and
_replace when replacing an existing entry is that _insert will destroy
the supplied new key and _replace will destroy the old key that was
stored in the table. In this example, it probably doesn't matter at all.

JÃrg




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]