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 346800 - Rework sort/filter models to use indices to parents instead of pointers
Rework sort/filter models to use indices to parents instead of pointers
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: GtkTreeView
2.10.x
Other Linux
: Low normal
: ---
Assigned To: gtktreeview-bugs
gtktreeview-bugs
: 339631 342938 346885 347542 347757 347875 348991 349058 349093 349101 349317 349376 349647 350078 350184 350279 350361 350478 350604 350871 350874 351017 351019 351189 351221 351382 351676 351722 351807 351816 351840 351841 351871 351878 351950 351988 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2006-07-06 20:14 UTC by William Jon McCann
Modified: 2011-02-04 16:11 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch to clean up hide when empty behavior (23.21 KB, patch)
2006-07-12 17:26 UTC, William Jon McCann
none Details | Review
patch (23.84 KB, patch)
2006-07-12 18:03 UTC, William Jon McCann
committed Details | Review
patch (23.88 KB, patch)
2006-07-12 19:16 UTC, William Jon McCann
none Details | Review
test case (1.44 KB, text/plain)
2006-08-06 03:21 UTC, Jonathan Matthew
  Details
gtk+ patch (673 bytes, patch)
2006-08-06 04:01 UTC, Jonathan Matthew
none Details | Review
rework sort model (13.52 KB, patch)
2006-10-30 18:30 UTC, Kristian Rietveld
none Details | Review

Description William Jon McCann 2006-07-06 20:14:49 UTC
HEAD from today.  I feel like I've reported this before but I can't find the bug.

Attempt to remove filter function 0xe15dc0 user data 0x8e898f8, but no such filter has been added
NameOwnerChanged org.gnome.Rhythmbox ->:1.7

Gtk-ERROR **: file gtktreemodelfilter.c: line 2237 (gtk_tree_model_filter_get_path): assertion failed: (i < level->array->len)
aborting...


Using host libthread_db library "/lib/libthread_db.so.1".
`shared object read from target memory' has disappeared; keeping its symbols.
[Thread debugging using libthread_db enabled]
[New Thread -1208838448 (LWP 12410)]
0x00abe402 in __kernel_vsyscall ()

Thread 1 (Thread -1208838448 (LWP 12410))

  • #0 __kernel_vsyscall
  • #1 __waitpid_nocancel
    from /lib/libpthread.so.0
  • #2 libgnomeui_segv_handle
    at gnome-ui-init.c line 865

Comment 1 Alex Lancaster 2006-07-07 23:19:45 UTC
*** Bug 346885 has been marked as a duplicate of this bug. ***
Comment 2 Bill Nottingham 2006-07-08 03:00:37 UTC
I've seen this on 0.9.5 as well, but it happens only occasionally (it will fail 10  times in a row, but when I try hours later, it works.) Only thing I can think that would be different between runs is scanned local shares that it's found...

gtk2-2.10.0, if that makes a difference.
Comment 3 James "Doc" Livingston 2006-07-11 09:44:47 UTC
I'm not sure if it's what caused the crash, but we're not holding the GDK lock in the code in the backtrace. It's a bit tricky because the entry-added signal may be  emitted with or without the lock being held, depending on what made it happen. And we can't just grab it, because it's a GMuted which may not be recursive. Urk.
Comment 4 William Jon McCann 2006-07-12 16:01:16 UTC
Another datapoint: doesn't crash for me when not connected to the network and no audio CD is in the drive.
Comment 5 Bill Nottingham 2006-07-12 16:15:24 UTC
From watching the display update when it crashes and when it doesn't, it may be related to updates to the sources when scanning the library; it crashes for me about 2/3 of the way through scanning the library of local files. (And yet, other times it scans them all fine.)
Comment 6 William Jon McCann 2006-07-12 17:25:00 UTC
It seems that there is an interaction between daap sources and setting the visibility of the missing files source.

Tracking this down is complicated a bit by the way that visibility is handed for the missing files and import errors sources.
Comment 7 William Jon McCann 2006-07-12 17:26:42 UTC
Created attachment 68827 [details] [review]
patch to clean up hide when empty behavior

This makes hidden-when-empty a property on the source.  This cleans up the API a bit and saves a bit of memory.  Look OK to commit?
Comment 8 William Jon McCann 2006-07-12 18:03:05 UTC
Created attachment 68831 [details] [review]
patch

Looks like a reentrancy issue to me.  We can avoid this by deferring the visibility notification into an idle.  So far this patch seems to fix it for me.  Bill can you test it?
Comment 9 William Jon McCann 2006-07-12 18:15:26 UTC
Sorry, no that doesn't fix it.  Might still be a good thing to do though.
Comment 10 William Jon McCann 2006-07-12 18:49:58 UTC
*** Bug 339631 has been marked as a duplicate of this bug. ***
Comment 11 William Jon McCann 2006-07-12 19:16:44 UTC
Created attachment 68832 [details] [review]
patch

Take the gdk lock when doing the refilter iteration.  Seems to work for me so far (after 30 restarts or so).
Comment 12 Bill Nottingham 2006-07-12 19:21:24 UTC
Hm, doesn't apply striaght to 0.9.5. Will prod it and try.
Comment 13 William Jon McCann 2006-07-12 19:49:45 UTC
The most recent patch crashes in a slightly different way after many successful tries.

Using host libthread_db library "/lib/libthread_db.so.1".
`shared object read from target memory' has disappeared; keeping its symbols.
[Thread debugging using libthread_db enabled]
[New Thread -1208944096 (LWP 1546)]
[New Thread 52984736 (LWP 1554)]
0x00abe402 in __kernel_vsyscall ()

Thread 1 (Thread -1208944096 (LWP 1546))

  • #0 __kernel_vsyscall
  • #1 __waitpid_nocancel
    from /lib/libpthread.so.0
  • #2 libgnomeui_segv_handle
    at gnome-ui-init.c line 865

Comment 14 Bill Nottingham 2006-07-12 19:59:43 UTC
Still crashes with the patch for me as well.
Comment 15 Jonathan Matthew 2006-07-12 22:46:43 UTC
Regardless of whether it actually fixes anything, the patch looks OK to me.
Seems I need to do something about my editor leaving trailing whitespace everywhere, too.
Comment 16 William Jon McCann 2006-07-12 23:30:36 UTC
Committed the patch without the gdk lock.
Comment 17 Karsten Bräckelmann 2006-07-17 11:12:12 UTC
*** Bug 347542 has been marked as a duplicate of this bug. ***
Comment 18 Karsten Bräckelmann 2006-07-17 11:13:24 UTC
*** Bug 347757 has been marked as a duplicate of this bug. ***
Comment 19 William Jon McCann 2006-07-18 12:47:13 UTC
*** Bug 347875 has been marked as a duplicate of this bug. ***
Comment 20 Nguyen Thai Ngoc Duy 2006-07-26 09:27:40 UTC
I'm pretty sure this only happens with gtk+ 2.10.0. Testing with 2.8.20 is ok.
Comment 21 Žygimantas Beručka 2006-07-27 08:18:44 UTC
I want to add, that while I was on dapper with gtk+ 2.8, it was fine. After upgrading to edgy I'm not able to start it without crash. Gtk+ 2.10.1 didn't solved it (if it's Gtk+'s fault).
Comment 22 Fabio Bonelli 2006-07-27 21:32:03 UTC
*** Bug 348991 has been marked as a duplicate of this bug. ***
Comment 23 Fabio Bonelli 2006-07-28 09:58:25 UTC
*** Bug 349058 has been marked as a duplicate of this bug. ***
Comment 24 William Jon McCann 2006-07-28 16:03:06 UTC
*** Bug 349101 has been marked as a duplicate of this bug. ***
Comment 25 Sergej Kotliar 2006-07-28 16:55:24 UTC
*** Bug 349093 has been marked as a duplicate of this bug. ***
Comment 26 James "Doc" Livingston 2006-07-31 03:17:40 UTC
*** Bug 349317 has been marked as a duplicate of this bug. ***
Comment 27 James "Doc" Livingston 2006-07-31 03:17:51 UTC
*** Bug 349376 has been marked as a duplicate of this bug. ***
Comment 28 James "Doc" Livingston 2006-08-02 11:39:07 UTC
*** Bug 349647 has been marked as a duplicate of this bug. ***
Comment 29 Jonathan Matthew 2006-08-05 04:08:26 UTC
*** Bug 342938 has been marked as a duplicate of this bug. ***
Comment 30 Jonathan Matthew 2006-08-05 09:17:20 UTC
Looks like a reference counting problem (or perhaps some bizarre memory corruption).

==9426== 
==9426== Invalid read of size 4
==9426==    at 0x42E4997: gtk_tree_model_filter_row_changed (gtktreemodelfilter.c:1296)
==9426==    by 0x42E4D75: gtk_tree_model_filter_refilter_helper (gtktreemodelfilter.c:3283)
==9426==    by 0x42DFDA7: gtk_tree_model_foreach_helper (gtktreemodel.c:1569)
==9426==    by 0x42DFDE6: gtk_tree_model_foreach_helper (gtktreemodel.c:1575)
==9426==    by 0x42E059C: gtk_tree_model_foreach (gtktreemodel.c:1615)
==9426==    by 0x42E16F4: gtk_tree_model_filter_refilter (gtktreemodelfilter.c:3303)
==9426==    by 0x8097403: visibility_notify_cb (rb-sourcelist.c:830)
==9426==    by 0x4E294CA: g_cclosure_marshal_VOID__PARAM (gmarshal.c:531)
==9426==    by 0x4E1CA2A: g_closure_invoke (gclosure.c:490)
==9426==    by 0x4E2CEBC: signal_emit_unlocked_R (gsignal.c:2438)
==9426==    by 0x4E2E3B8: g_signal_emit_valist (gsignal.c:2197)
==9426==    by 0x4E2E568: g_signal_emit (gsignal.c:2241)
==9426==  Address 0x5894298 is 32 bytes inside a block of size 252 free'd
==9426==    at 0x401C139: free (vg_replace_malloc.c:233)
==9426==    by 0x4BA589A: cairo_surface_destroy (in /usr/lib/libcairo.so.2.9.0)
==9426==    by 0x4BA8FF9: (within /usr/lib/libcairo.so.2.9.0)
==9426==    by 0x4BBEA98: (within /usr/lib/libcairo.so.2.9.0)
==9426==    by 0x4BA5184: (within /usr/lib/libcairo.so.2.9.0)
==9426==    by 0x4B9A088: (within /usr/lib/libcairo.so.2.9.0)
==9426==    by 0x4B94763: cairo_show_glyphs (in /usr/lib/libcairo.so.2.9.0)
==9426==    by 0x4B500E3: (within /usr/lib/libpangocairo-1.0.so.0.1201.2)
==9426==    by 0x4B724C4: pango_renderer_draw_glyphs (in /usr/lib/libpango-1.0.so.0.1201.2)
==9426==    by 0x4B4F61E: pango_cairo_show_glyph_string (in /usr/lib/libpangocairo-1.0.so.0.1201.2)
==9426==    by 0x4441FD8: gdk_pango_renderer_draw_glyphs (gdkpango.c:244)
==9426==    by 0x4B724C4: pango_renderer_draw_glyphs (in /usr/lib/libpango-1.0.so.0.1201.2)

Gtk-ERROR **: file gtktreemodelfilter.c: line 2237 (gtk_tree_model_filter_get_path): assertion failed: (i < level->array->len)
aborting...
Comment 31 Jonathan Matthew 2006-08-05 13:43:03 UTC
Revision 1.34 of gtktreemodelfilter.c doesn't crash, revision 1.35 does.  The diff between the two is huge, and I don't understand any of the code all that well.  Fun.
Comment 32 Karsten Bräckelmann 2006-08-05 17:04:00 UTC
*** Bug 350078 has been marked as a duplicate of this bug. ***
Comment 33 Jonathan Matthew 2006-08-06 03:21:51 UTC
Created attachment 70290 [details]
test case

This program reproduces the problem at around iteration 17 (for me - it depends on memory allocation behaviour).  The exact tree store manipulations probably don't matter; I was just trying to do something that vaguely resembled what the RB source list does.
Comment 34 Jonathan Matthew 2006-08-06 04:01:31 UTC
Created attachment 70291 [details] [review]
gtk+ patch

This patch to gtk+ fixes the problem for me, both in the above test program and in rhythmbox.  GtkTreeModelFilter needs to update all of a FilterLevel's children when it inserts a new element into level->array, as doing so can result in the whole array moving.  In gtk_tree_model_filter_fetch_child, it was trying to only update the children after the point where a new FilterElt was inserted.
Comment 35 Jonathan Matthew 2006-08-06 04:13:20 UTC
Reassigning to gtk+, obsoleting patches.  It looks like the bug is present on the gtk-2-8 branch, but it doesn't get triggered in this case for some reason.
Comment 36 Ed Catmur 2006-08-06 14:21:22 UTC
Confirming patch works here.
Comment 37 Jonathan Matthew 2006-08-06 21:58:23 UTC
*** Bug 350184 has been marked as a duplicate of this bug. ***
Comment 38 Jonathan Matthew 2006-08-07 21:30:31 UTC
*** Bug 350279 has been marked as a duplicate of this bug. ***
Comment 39 James "Doc" Livingston 2006-08-08 05:20:00 UTC
*** Bug 350361 has been marked as a duplicate of this bug. ***
Comment 40 Baptiste Mille-Mathias 2006-08-08 19:29:15 UTC
*** Bug 350478 has been marked as a duplicate of this bug. ***
Comment 41 James "Doc" Livingston 2006-08-09 15:04:04 UTC
*** Bug 350604 has been marked as a duplicate of this bug. ***
Comment 42 Sebastien Bacher 2006-08-10 19:48:05 UTC
Ubuntu bug about that: https://launchpad.net/distros/ubuntu/+source/rhythmbox/+bug/55866

That bug has quite some duplicates and a patch, is somebody looking to it?
Comment 43 Sebastien Bacher 2006-08-10 22:54:19 UTC
that patch fixes the issue with rhythmbox for the submitter of the ubuntu bug too
Comment 44 James "Doc" Livingston 2006-08-11 12:31:54 UTC
*** Bug 350871 has been marked as a duplicate of this bug. ***
Comment 45 James "Doc" Livingston 2006-08-11 12:32:04 UTC
*** Bug 350874 has been marked as a duplicate of this bug. ***
Comment 46 James "Doc" Livingston 2006-08-12 10:02:19 UTC
*** Bug 351019 has been marked as a duplicate of this bug. ***
Comment 47 James "Doc" Livingston 2006-08-12 10:02:32 UTC
*** Bug 351017 has been marked as a duplicate of this bug. ***
Comment 48 Jonathan Matthew 2006-08-13 21:23:01 UTC
*** Bug 351189 has been marked as a duplicate of this bug. ***
Comment 49 James "Doc" Livingston 2006-08-14 03:03:32 UTC
*** Bug 351221 has been marked as a duplicate of this bug. ***
Comment 50 Matthias Clasen 2006-08-14 18:49:33 UTC
Kris, can you comment on the patch in #34, please ?
Comment 51 James "Doc" Livingston 2006-08-15 03:11:55 UTC
*** Bug 351382 has been marked as a duplicate of this bug. ***
Comment 52 Kristian Rietveld 2006-08-16 14:37:26 UTC
(In reply to comment #34)
> This patch to gtk+ fixes the problem for me, both in the above test program and
> in rhythmbox.  GtkTreeModelFilter needs to update all of a FilterLevel's
> children when it inserts a new element into level->array, as doing so can
> result in the whole array moving.  In gtk_tree_model_filter_fetch_child, it was
> trying to only update the children after the point where a new FilterElt was
> inserted.

Oh, really good catch.
 

(In reply to comment #35)
> Reassigning to gtk+, obsoleting patches.  It looks like the bug is present on
> the gtk-2-8 branch, but it doesn't get triggered in this case for some reason.

I think there's a good chance that is triggered now that GArray has been moved over to GArray.  Anyway, I will commit this on 2-8 as well.
Comment 53 Kristian Rietveld 2006-08-16 14:38:11 UTC
(Oh, and sorry that this took so long, but I was busy with other things ...).
Comment 54 Tim Janik 2006-08-16 14:53:35 UTC
looking at the patch/code, the problem here really is that the array elements store pointers to other array elements. those pointers can become invalid with *any* kind of array modification, so the only proper fix here (at least long term) is to convert FilterElt.children to an index, rather than a pointer.
Comment 55 Kristian Rietveld 2006-08-16 15:20:33 UTC
Needs to happen for the sort model too then.  Putting on the 2.12 list.
Comment 56 Jonathan Matthew 2006-08-16 21:09:21 UTC
*** Bug 351676 has been marked as a duplicate of this bug. ***
Comment 57 Jonathan Matthew 2006-08-17 10:09:12 UTC
*** Bug 351722 has been marked as a duplicate of this bug. ***
Comment 58 Baptiste Mille-Mathias 2006-08-17 18:41:17 UTC
*** Bug 351807 has been marked as a duplicate of this bug. ***
Comment 59 Jonathan Matthew 2006-08-17 21:02:54 UTC
*** Bug 351816 has been marked as a duplicate of this bug. ***
Comment 60 Jonathan Matthew 2006-08-17 21:48:21 UTC
*** Bug 351840 has been marked as a duplicate of this bug. ***
Comment 61 Jonathan Matthew 2006-08-17 21:49:05 UTC
*** Bug 351841 has been marked as a duplicate of this bug. ***
Comment 62 Jonathan Matthew 2006-08-18 11:34:55 UTC
*** Bug 351878 has been marked as a duplicate of this bug. ***
Comment 63 Jonathan Matthew 2006-08-18 11:35:41 UTC
*** Bug 351871 has been marked as a duplicate of this bug. ***
Comment 64 Jonathan Matthew 2006-08-18 21:28:47 UTC
*** Bug 351988 has been marked as a duplicate of this bug. ***
Comment 65 Jonathan Matthew 2006-08-18 21:29:26 UTC
*** Bug 351950 has been marked as a duplicate of this bug. ***
Comment 66 Kristian Rietveld 2006-10-30 18:30:54 UTC
Created attachment 75681 [details] [review]
rework sort model

This patch reworks the sort model to use an index to the parent element instead of a pointer.  I've shortly tested it with testtreesort and it seems to work; however I want to do some extensive testing before I commit.  The fix for the filter model will look likewise, but still have to cook that one up.
Comment 67 Alex Lancaster 2006-11-23 00:26:30 UTC
*** Bug 378223 has been marked as a duplicate of this bug. ***
Comment 68 Philip Withnall 2007-05-28 13:27:22 UTC
Kristian, did you manage to test your patch more extensively?
Comment 69 Kristian Rietveld 2007-05-28 20:43:25 UTC
This patch is not going in until I have written an extensive test suite for tree models and I also reworked the filter model.

Comment 70 Peter Clifton 2007-08-11 23:51:57 UTC
Am I right in thinking the following stack trace is similar / the same as this bug? (GTK 2.11.6)

Strangely, I can only ever reporoduce this when running under electric-fence, although electric-fence doesn't etect any badness.

The app is gschem, part of the GPL EDA suite (gEDA).

Are any app-level workarounds / coding practices which would prevent it?



Gtk-ERROR **: file /build/buildd/gtk+2.0-2.11.6/gtk/gtktreemodelfilter.c: line 2236 (gtk_tree_model_filter_get_path): assertion failed: (i < level->array->len)
aborting...

Program received signal SIGTRAP, Trace/breakpoint trap.

Thread NaN (LWP 16121)

  • #0 IA__g_logv
  • #1 IA__g_log
  • #2 IA__g_assert_warning
    at /home/pcjc2/source/glib2.0-2.13.7/glib/gmessages.c line 552
  • #3 gtk_tree_model_filter_get_path
    at /build/buildd/gtk+2.0-2.11.6/gtk/gtktreemodelfilter.c line 2236
  • #4 IA__gtk_tree_model_get_path
    at /build/buildd/gtk+2.0-2.11.6/gtk/gtktreemodel.c line 1114
  • #5 gtk_tree_model_filter_row_changed
    at /build/buildd/gtk+2.0-2.11.6/gtk/gtktreemodelfilter.c line 1232
  • #6 gtk_tree_model_filter_refilter_helper
    at /build/buildd/gtk+2.0-2.11.6/gtk/gtktreemodelfilter.c line 3284
  • #7 gtk_tree_model_foreach_helper
    at /build/buildd/gtk+2.0-2.11.6/gtk/gtktreemodel.c line 1578
  • #8 gtk_tree_model_foreach_helper
    at /build/buildd/gtk+2.0-2.11.6/gtk/gtktreemodel.c line 1584
  • #9 IA__gtk_tree_model_foreach
    at /build/buildd/gtk+2.0-2.11.6/gtk/gtktreemodel.c line 1624
  • #10 IA__gtk_tree_model_filter_refilter
    at /build/buildd/gtk+2.0-2.11.6/gtk/gtktreemodelfilter.c line 3304
  • #11 compselect_filter_timeout
    at x_compselect.c line 478
  • #12 g_timeout_dispatch
    at /home/pcjc2/source/glib2.0-2.13.7/glib/gmain.c line 3488
  • #13 IA__g_main_context_dispatch
    at /home/pcjc2/source/glib2.0-2.13.7/glib/gmain.c line 2061
  • #14 g_main_context_iterate
    at /home/pcjc2/source/glib2.0-2.13.7/glib/gmain.c line 2694
  • #15 IA__g_main_loop_run
    at /home/pcjc2/source/glib2.0-2.13.7/glib/gmain.c line 2898
  • #16 IA__gtk_main
    at /build/buildd/gtk+2.0-2.11.6/gtk/gtkmain.c line 1144
  • #17 main_prog
    at gschem.c line 349
  • #18 scm_boot_guile
    at init.c line 635
  • #19 main
    at gschem.c line 374

Comment 71 Kristian Rietveld 2007-08-28 08:31:15 UTC
Punting until I finished the test suite.
Comment 72 Peter Clifton 2009-01-03 23:43:10 UTC
Ping!

Is this bug still present?
Comment 73 Kristian Rietveld 2009-07-30 12:28:41 UTC
Yes, I really want to get a test suite in place for the sort and filter models first before I continue committing changes there ...
Comment 74 Kristian Rietveld 2009-09-01 09:43:09 UTC
Marking filter model bugs I want to look into shortly as ASSIGNED.  (I am working into getting the test suite as mentioned in comment 73 into place.).
Comment 75 Kristian Rietveld 2009-09-06 12:12:29 UTC
The test suite is now there.  Both the sort and filter models have now been converted.  Fixed on master.