aboutsummaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
authorfiaxh <git@mx.ax.lt>2017-11-22 21:09:39 +0100
committerfiaxh <git@mx.ax.lt>2017-11-23 01:28:29 +0100
commit64774241e587eab64b10a0c35dd455f6a2288a55 (patch)
treee019252bce51a684dc1c97c97d897a193715d360 /main
parent9165c4db278b2d3da636d53e89c3b80cff66977f (diff)
downloaddino-64774241e587eab64b10a0c35dd455f6a2288a55.tar.gz
dino-64774241e587eab64b10a0c35dd455f6a2288a55.zip
Fix memory leak
Diffstat (limited to 'main')
-rw-r--r--main/data/add_conversation/conference_details_fragment.ui1
-rw-r--r--main/po/dino.pot4
-rw-r--r--main/src/ui/add_conversation/select_jid_fragment.vala2
-rw-r--r--main/src/ui/conversation_summary/conversation_item_skeleton.vala3
-rw-r--r--main/src/ui/conversation_summary/conversation_view.vala8
-rw-r--r--main/src/ui/conversation_summary/message_populator.vala7
-rw-r--r--main/src/ui/conversation_titlebar/occupants_entry.vala8
-rw-r--r--main/src/ui/manage_accounts/dialog.vala3
-rw-r--r--main/src/ui/occupant_menu/view.vala2
9 files changed, 21 insertions, 17 deletions
diff --git a/main/data/add_conversation/conference_details_fragment.ui b/main/data/add_conversation/conference_details_fragment.ui
index 0ef15c03..a4f6f5d3 100644
--- a/main/data/add_conversation/conference_details_fragment.ui
+++ b/main/data/add_conversation/conference_details_fragment.ui
@@ -250,7 +250,6 @@
<object class="GtkLabel" id="notification_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="label" translatable="yes">This is an app-notification. Click the button to dismiss</property>
</object>
<packing>
<property name="expand">False</property>
diff --git a/main/po/dino.pot b/main/po/dino.pot
index 5aba5b75..c2735852 100644
--- a/main/po/dino.pot
+++ b/main/po/dino.pot
@@ -59,10 +59,6 @@ msgstr ""
msgid "Password"
msgstr ""
-#: ../data/add_conversation/conference_details_fragment.ui:253
-msgid "This is an app-notification. Click the button to dismiss"
-msgstr ""
-
#: ../data/conversation_selector/view.ui:14
msgid "Search"
msgstr ""
diff --git a/main/src/ui/add_conversation/select_jid_fragment.vala b/main/src/ui/add_conversation/select_jid_fragment.vala
index d34a22d7..ae157d9b 100644
--- a/main/src/ui/add_conversation/select_jid_fragment.vala
+++ b/main/src/ui/add_conversation/select_jid_fragment.vala
@@ -47,7 +47,7 @@ public class SelectJidFragment : Gtk.Box {
public void set_filter(string str) {
if (entry.text != str) entry.text = str;
- foreach (AddListRow row in added_rows) filterable_list.remove(row);
+ foreach (AddListRow row in added_rows) row.destroy();
added_rows.clear();
string[] ? values = str == "" ? null : str.split(" ");
diff --git a/main/src/ui/conversation_summary/conversation_item_skeleton.vala b/main/src/ui/conversation_summary/conversation_item_skeleton.vala
index ed540e5d..03e9facb 100644
--- a/main/src/ui/conversation_summary/conversation_item_skeleton.vala
+++ b/main/src/ui/conversation_summary/conversation_item_skeleton.vala
@@ -46,7 +46,8 @@ public class ConversationItemSkeleton : Grid {
}
public void remove_meta_item(Plugins.MetaConversationItem item) {
- box.remove(item_widgets[item]);
+ item_widgets[item].destroy();
+ item_widgets.unset(item);
items.remove(item);
}
diff --git a/main/src/ui/conversation_summary/conversation_view.vala b/main/src/ui/conversation_summary/conversation_view.vala
index 5aeb27fc..15a86ca7 100644
--- a/main/src/ui/conversation_summary/conversation_view.vala
+++ b/main/src/ui/conversation_summary/conversation_view.vala
@@ -84,9 +84,10 @@ public class ConversationView : Box, Plugins.ConversationItemCollection {
if (skeleton.items.size > 1) {
skeleton.remove_meta_item(item);
} else {
- main.remove(widgets[item]);
+ widgets[item].destroy();
widgets.unset(item);
- item_skeletons.remove(item_item_skeletons[item]);
+ skeleton.destroy();
+ item_skeletons.remove(skeleton);
item_item_skeletons.unset(item);
}
meta_items.remove(item);
@@ -233,7 +234,8 @@ public class ConversationView : Box, Plugins.ConversationItemCollection {
meta_after_items.clear();
item_skeletons.clear();
item_item_skeletons.clear();
- main.@foreach((widget) => { main.remove(widget); });
+ widgets.clear();
+ main.@foreach((widget) => { widget.destroy(); });
}
}
diff --git a/main/src/ui/conversation_summary/message_populator.vala b/main/src/ui/conversation_summary/message_populator.vala
index dc4b5770..df44a14b 100644
--- a/main/src/ui/conversation_summary/message_populator.vala
+++ b/main/src/ui/conversation_summary/message_populator.vala
@@ -55,8 +55,13 @@ public class MessagePopulator : Object {
if (meta_item == null) return;
meta_item.mark = message.marked;
+ WeakRef weak_meta_item = WeakRef(meta_item);
+ WeakRef weak_message = WeakRef(message);
message.notify["marked"].connect(() => {
- meta_item.mark = message.marked;
+ Plugins.MetaConversationItem? mi = weak_meta_item.get() as Plugins.MetaConversationItem;
+ Message? m = weak_message.get() as Message;
+ if (mi == null || m == null) return;
+ mi.mark = m.marked;
});
item_collection.insert_item(meta_item);
}
diff --git a/main/src/ui/conversation_titlebar/occupants_entry.vala b/main/src/ui/conversation_titlebar/occupants_entry.vala
index d6ce7f68..0646eee7 100644
--- a/main/src/ui/conversation_titlebar/occupants_entry.vala
+++ b/main/src/ui/conversation_titlebar/occupants_entry.vala
@@ -29,9 +29,9 @@ class OccupantsWidget : MenuButton, Plugins.ConversationTitlebarWidget {
private Conversation? conversation;
private StreamInteractor stream_interactor;
private Window window;
+ private OccupantMenu.View menu = null;
public OccupantsWidget(StreamInteractor stream_interactor, Window window) {
-
image = new Image.from_icon_name("system-users-symbolic", IconSize.MENU);
this.stream_interactor = stream_interactor;
@@ -44,8 +44,10 @@ class OccupantsWidget : MenuButton, Plugins.ConversationTitlebarWidget {
visible = conversation.type_ == Conversation.Type.GROUPCHAT;
if (conversation.type_ == Conversation.Type.GROUPCHAT) {
- OccupantMenu.View menu = new OccupantMenu.View(stream_interactor, window, conversation);
- set_popover(menu);
+ OccupantMenu.View new_menu = new OccupantMenu.View(stream_interactor, window, conversation);
+ set_popover(new_menu);
+ if (menu != null) menu.destroy();
+ menu = new_menu;
}
}
}
diff --git a/main/src/ui/manage_accounts/dialog.vala b/main/src/ui/manage_accounts/dialog.vala
index f82e90c0..f2228cea 100644
--- a/main/src/ui/manage_accounts/dialog.vala
+++ b/main/src/ui/manage_accounts/dialog.vala
@@ -128,8 +128,7 @@ public class Dialog : Gtk.Dialog {
ok_button.label = _("Remove");
ok_button.get_style_context().add_class("destructive-action");
if (msg.run() == Gtk.ResponseType.OK) {
- account_list.remove(account_item);
- account_list.queue_draw();
+ account_item.destroy();
if (account_item.account.enabled) account_disabled(account_item.account);
account_item.account.remove();
if (account_list.get_row_at_index(0) != null) {
diff --git a/main/src/ui/occupant_menu/view.vala b/main/src/ui/occupant_menu/view.vala
index fb63a06a..a76f370a 100644
--- a/main/src/ui/occupant_menu/view.vala
+++ b/main/src/ui/occupant_menu/view.vala
@@ -94,7 +94,7 @@ public class View : Popover {
kick_button.clicked.connect(kick_button_clicked);
}
- if (jid_menu != null) stack.remove(jid_menu);
+ if (jid_menu != null) jid_menu.destroy();
stack.add_named(outer_box, "menu");
stack.visible_child_name = "menu";
jid_menu = outer_box;