Re: glib hash table assertion failures: need help in debuging
- From: "Jasper St. Pierre" <jstpierre mecheye net>
- To: Akash Rawal <argmlac gmail com>
- Cc: gtk-list gnome org
- Subject: Re: glib hash table assertion failures: need help in debuging
- Date: Wed, 6 Jun 2012 14:49:56 -0400
On Mon, Jun 4, 2012 at 2:18 AM, Akash Rawal <argmlac gmail com> wrote:
> Hi all,
>
> I have a GHashTable related question.
>
> I am writing a volume monitor for GIO.
>
> I have a code like this:
>
> 186 void pup_conv_mgr_close_all_convs(PupConvMgr *cmgr,
> PupConvCloseFlags flags)
> 187 {
> 188 GHashTableIter iter;
> 189 PupConv *oneconv;
> 190 g_hash_table_iter_init(&iter, cmgr->self_convs);
> 191 while(g_hash_table_iter_next(&iter, NULL, (gpointer
> *)&oneconv))
> 192 {
> 193 pup_conv_close(oneconv, flags | PUP_CONV_NOREMOVE);
> 194 if (flags& PUP_CONV_FREE)
> 195 g_hash_table_iter_remove(&iter);
> 196 }
> 197 g_hash_table_iter_init(&iter, cmgr->other_convs);
> 198 while(g_hash_table_iter_next(&iter, NULL, (gpointer
> *)&oneconv))
> 199 {
> 200 pup_conv_close(oneconv, flags | PUP_CONV_NOREMOVE);
> 201 if (flags& PUP_CONV_FREE)
> 202 g_hash_table_iter_remove(&iter);
> 203 }
> 204 }
>
> Exactly at line 198 I get a warning like:
>
> (pup-volume-monitor:4276): GLib-CRITICAL **: g_hash_table_iter_next:
> assertion `ri->version == ri->hash_table->version' failed
When you do g_hash_table_iter_remove, it increments a field on the
iterator and the hash table to ensure that the two don't get out of
sync. Removing while iterating is sort of a difficult problem. Are you
removing something else from the same hash table in your destroy
function that you passed to g_hash_table_init ?
> Although nothing worse happens, but I am curious to know why I get this.
>
> Thanks in advance.
>
> _______________________________________________
> gtk-list mailing list
> gtk-list gnome org
> https://mail.gnome.org/mailman/listinfo/gtk-list
--
Jasper
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]