[gitg/vala: 25/35] cache the iter while iterating over the children
- From: Ignacio Casal Quinteiro <icq src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gitg/vala: 25/35] cache the iter while iterating over the children
- Date: Wed, 11 Jul 2012 15:19:33 +0000 (UTC)
commit 117d9e3c9e79292a4aa112d68604891eef4ad5eb
Author: Guillaume Desmottes <guillaume desmottes collabora co uk>
Date: Tue May 29 16:04:45 2012 +0200
cache the iter while iterating over the children
The iter may be destroyed in the callback.
egg-list-box.vala | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
---
diff --git a/egg-list-box.vala b/egg-list-box.vala
index 2be33a6..beeaa77 100644
--- a/egg-list-box.vala
+++ b/egg-list-box.vala
@@ -852,8 +852,10 @@ public class Egg.ListBox : Container {
public override void forall_internal (bool include_internals,
Gtk.Callback callback) {
- for (var iter = children.get_begin_iter (); !iter.is_end (); iter = iter.next ()) {
+ var iter = children.get_begin_iter ();
+ while (!iter.is_end ()) {
unowned ChildInfo child_info = iter.get ();
+ iter = iter.next();
if (child_info.separator != null && include_internals)
callback (child_info.separator);
callback (child_info.widget);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]