After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 618454 - Seed is unable to use HashTables as parameters or return values
Seed is unable to use HashTables as parameters or return values
Status: RESOLVED FIXED
Product: seed
Classification: Bindings
Component: libseed
git master
Other Linux
: Normal normal
: ---
Assigned To: seed-maint
seed-maint
Depends on:
Blocks:
 
 
Reported: 2010-05-12 14:26 UTC by Gustavo Noronha (kov)
Modified: 2013-02-14 02:16 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
first cut implementation (4.62 KB, patch)
2010-05-12 14:29 UTC, Gustavo Noronha (kov)
none Details | Review
[PATCH] implement hashtables conversion between js and gi values (6.22 KB, patch)
2013-02-13 17:57 UTC, Alban Crequy
none Details | Review

Description Gustavo Noronha (kov) 2010-05-12 14:26:46 UTC
So if I want to use API such as this, it doesn't work:

var message = new Soup.Message();
message.request_headers.set_content_type('text/plain', { 'charset' : 'UTF-8' });
Comment 1 Gustavo Noronha (kov) 2010-05-12 14:29:37 UTC
Created attachment 160903 [details] [review]
first cut implementation
Comment 2 Alan Knowles 2010-06-17 06:17:50 UTC
It needs memory management fixing - It's probably worth commiting in as is, and keeping this bug open as 'hashtables need memory fixing'

should really use:
g_hash_table_new_full
-- to create the has table, and add hooks to free the keys.. values are a bit more complex..........

adding gobject's I think we need to ref them.  and unref on destruction.

add g_hash_table_destroy to  seed_release_arg
Comment 3 Alban Crequy 2013-02-13 17:57:53 UTC
Created attachment 235933 [details] [review]
[PATCH] implement hashtables conversion between js and gi values

I updated Gustavo's patch:
- rebase on master and update with new code
- use g_hash_table_new_full to free the keys
- free the hash table's values and the hash table itself in seed_release_arg.

Tests:
- I only tested GHashTable(utf8, utf8)
- I only tested "in" parameter with "transfer-none"
=> In this case, it is freed correctly.

My use case was:
Soup.form_request_new_from_hash('GET', 'http://foo', {'s': 'foo', 'f': 'bar'});
Comment 4 Alan Knowles 2013-02-14 02:16:49 UTC
I'm closing for now (as the patch is applied)

I guess if someone finds a non 'transfer-none' situation, and it leaks they can file a new bug...