aboutsummaryrefslogtreecommitdiff
path: root/main/src
diff options
context:
space:
mode:
authorfiaxh <git@lightrise.org>2023-01-11 19:49:27 +0100
committerfiaxh <git@lightrise.org>2023-01-11 19:54:17 +0100
commit860c72bfc93d252d45eb97e71cf9ff22985c7ef9 (patch)
tree8339c77919032626e6c5027539eb81b096663e54 /main/src
parent75500dc767f2cf657c0fbb5d2a4d4557183ed2e9 (diff)
downloaddino-860c72bfc93d252d45eb97e71cf9ff22985c7ef9.tar.gz
dino-860c72bfc93d252d45eb97e71cf9ff22985c7ef9.zip
Fix crash when removing jid from roster
fixes #1332
Diffstat (limited to 'main/src')
-rw-r--r--main/src/ui/add_conversation/roster_list.vala9
-rw-r--r--main/src/ui/add_conversation/select_contact_dialog.vala2
2 files changed, 6 insertions, 5 deletions
diff --git a/main/src/ui/add_conversation/roster_list.vala b/main/src/ui/add_conversation/roster_list.vala
index 25827d67..bb338ce5 100644
--- a/main/src/ui/add_conversation/roster_list.vala
+++ b/main/src/ui/add_conversation/roster_list.vala
@@ -14,7 +14,7 @@ protected class RosterList {
private ulong[] handler_ids = new ulong[0];
private ListBox list_box = new ListBox();
- private HashMap<Account, HashMap<Jid, ListRow>> rows = new HashMap<Account, HashMap<Jid, ListRow>>(Account.hash_func, Account.equals_func);
+ private HashMap<Account, HashMap<Jid, ListBoxRow>> rows = new HashMap<Account, HashMap<Jid, ListBoxRow>>(Account.hash_func, Account.equals_func);
public RosterList(StreamInteractor stream_interactor, Gee.List<Account> accounts) {
this.stream_interactor = stream_interactor;
@@ -47,14 +47,15 @@ protected class RosterList {
private void on_updated_roster_item(Account account, Jid jid, Roster.Item roster_item) {
on_removed_roster_item(account, jid, roster_item);
ListRow row = new ListRow.from_jid(stream_interactor, roster_item.jid, account, accounts.size > 1);
- rows[account][jid] = row;
- list_box.append(row);
+ ListBoxRow list_box_row = new ListBoxRow() { child=row };
+ rows[account][jid] = list_box_row;
+ list_box.append(list_box_row);
list_box.invalidate_sort();
list_box.invalidate_filter();
}
private void fetch_roster_items(Account account) {
- rows[account] = new HashMap<Jid, ListRow>(Jid.hash_func, Jid.equals_func);
+ rows[account] = new HashMap<Jid, ListBoxRow>(Jid.hash_func, Jid.equals_func);
foreach (Roster.Item roster_item in stream_interactor.get_module(RosterManager.IDENTITY).get_roster(account)) {
on_updated_roster_item(account, roster_item.jid, roster_item);
}
diff --git a/main/src/ui/add_conversation/select_contact_dialog.vala b/main/src/ui/add_conversation/select_contact_dialog.vala
index 09ac1636..b18f4c10 100644
--- a/main/src/ui/add_conversation/select_contact_dialog.vala
+++ b/main/src/ui/add_conversation/select_contact_dialog.vala
@@ -80,7 +80,7 @@ public class SelectContactDialog : Gtk.Dialog {
add_contact_dialog.present();
});
select_jid_fragment.remove_jid.connect((row) => {
- ListRow list_row = roster_list_box.get_selected_row() as ListRow;
+ ListRow list_row = roster_list_box.get_selected_row().child as ListRow;
stream_interactor.get_module(RosterManager.IDENTITY).remove_jid(list_row.account, list_row.jid);
});
select_jid_fragment.notify["done"].connect(() => {