Merge lp:~ken-vandine/gwibber/lp_937607 into lp:gwibber

Proposed by Ken VanDine on 2012-03-14
Status: Merged
Merged at revision: 1314
Proposed branch: lp:~ken-vandine/gwibber/lp_937607
Merge into: lp:gwibber
Diff against target: 59 lines (+26/-14)
1 file modified
libgwibber/streams.vala (+26/-14)
To merge this branch: bzr merge lp:~ken-vandine/gwibber/lp_937607
Reviewer Review Type Date Requested Status
David Klasinc (community) 2012-03-14 Approve on 2012-03-14
Review via email: mp+97513@code.launchpad.net

Description of the change

Make sure we don't keep references to Dee.ModelIter that has been removed (LP: #937607)

To post a comment you must log in.
David Klasinc (bigwhale) wrote :

Looks good.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'libgwibber/streams.vala'
2--- libgwibber/streams.vala 2012-03-08 15:07:19 +0000
3+++ libgwibber/streams.vala 2012-03-14 20:57:39 +0000
4@@ -212,6 +212,15 @@
5 model = null;
6 model = create_model ();
7 }
8+ model.row_removed.connect((_m, _i) => {
9+ foreach (var v in seen.entries)
10+ {
11+ if (v.value == _i)
12+ {
13+ seen.unset(v.key);
14+ }
15+ }
16+ });
17 Idle.add(() => {
18 refresh_model_async.begin ();
19 return false;
20@@ -696,22 +705,25 @@
21 {
22 iter = seen.get(_textid);
23 if (iter == null)
24+ seen.unset(_textid);
25+ else
26+ {
27+ string[] _accounts_array = (string[])_model.get_value (iter, StreamModelColumn.ACCOUNTS);
28+ if (!(_acct in _accounts_array))
29+ {
30+ foreach (var a in _accounts_array)
31+ builder.add ("s", a);
32+ var _accounts = new Variant ("as", builder);
33+ _model.set_value (iter, StreamModelColumn.ACCOUNTS, _accounts);
34+ }
35+ _model.set_value (iter, StreamModelColumn.MESSAGE, _text);
36+ _model.set_value (iter, StreamModelColumn.HTML, _html);
37+ _model.set_value (iter, StreamModelColumn.TIMESTRING, _t);
38+ _model.set_value (iter, StreamModelColumn.LIKES, _likes);
39+ _model.set_value (iter, StreamModelColumn.LIKED, _liked);
40+ iter = null;
41 return;
42- string[] _accounts_array = (string[])_model.get_value (iter, StreamModelColumn.ACCOUNTS);
43- if (!(_acct in _accounts_array))
44- {
45- foreach (var a in _accounts_array)
46- builder.add ("s", a);
47- var _accounts = new Variant ("as", builder);
48- _model.set_value (iter, StreamModelColumn.ACCOUNTS, _accounts);
49 }
50- _model.set_value (iter, StreamModelColumn.MESSAGE, _text);
51- _model.set_value (iter, StreamModelColumn.HTML, _html);
52- _model.set_value (iter, StreamModelColumn.TIMESTRING, _t);
53- _model.set_value (iter, StreamModelColumn.LIKES, _likes);
54- _model.set_value (iter, StreamModelColumn.LIKED, _liked);
55- iter = null;
56- return;
57 }
58
59 var _accounts = new Variant ("as", builder);

Subscribers

People subscribed via source and target branches