Using iterators like GHashTableIter



Hi all,
  I'm trying to use libaccounts-glib [0] from python.So far all is good,
except iterating account settings. In C code, this would work in the
same way that GHashTable works:

=============
    AgAccountSettingIter iter;
    const gchar *key;
    const GValue *value;

    ag_account_settings_iter_init (account, &iter, NULL);
    while (ag_account_settings_iter_next (&iter, &key, &value))
    {
        ...do something with key and value...
    }
=============

However, I don't know how to use this in python. The following code
leads to a segmentation fault of the python interpreter itself:

=============
i = Accounts.AccountSettingsIter()
account.settings_iter_init(i, '') <- valgrind reports errors since here
key = None
value = None
while account.settings_iter_next(i, key, value):  <- crash
    print key
=============

I'm not posting the backtrace, because it's an unhelpful backtrace
pointing to malloc_consolidate.

Any idea of what could be the issue? The .gir file can be seen here:
http://pastebin.com/rWpqbx9i

TIA,
  Alberto

[0]:
http://code.google.com/p/accounts-sso/source/browse/?repo=libaccounts-glib


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