diff options
author | fiaxh <git@lightrise.org> | 2020-05-28 17:31:31 +0200 |
---|---|---|
committer | fiaxh <git@lightrise.org> | 2020-06-03 21:50:40 +0200 |
commit | 8fe723bccb1dbcc38ec2742195cc77702f7f3f52 (patch) | |
tree | c4b8f03db975149555266ed546e48e03f987ad9b /libdino | |
parent | a9e6a9c3d58002810757f1e3f4fc9c9488b48fc4 (diff) | |
download | dino-8fe723bccb1dbcc38ec2742195cc77702f7f3f52.tar.gz dino-8fe723bccb1dbcc38ec2742195cc77702f7f3f52.zip |
Fix cyclic references => let objects be freed
Diffstat (limited to 'libdino')
-rw-r--r-- | libdino/src/service/content_item_store.vala | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/libdino/src/service/content_item_store.vala b/libdino/src/service/content_item_store.vala index 640c3fda..7b320071 100644 --- a/libdino/src/service/content_item_store.vala +++ b/libdino/src/service/content_item_store.vala @@ -282,13 +282,7 @@ public class MessageItem : ContentItem { this.message = message; this.conversation = conversation; - - WeakRef weak_message = WeakRef(message); - message.notify["marked"].connect(() => { - Message? m = weak_message.get() as Message; - if (m == null) return; - mark = m.marked; - }); + message.bind_property("marked", this, "mark"); } } @@ -310,16 +304,13 @@ public class FileItem : ContentItem { this.file_transfer = file_transfer; this.conversation = conversation; + // TODO those don't work if (message != null) { - WeakRef weak_message = WeakRef(message); - message.notify["marked"].connect(() => { - Message? m = weak_message.get() as Message; - if (m == null) return; - this.mark = m.marked; - }); + message.bind_property("marked", this, "mark"); } else if (file_transfer.direction == FileTransfer.DIRECTION_SENT) { - file_transfer.notify["state"].connect_after(() => { - this.mark = file_to_message_state(file_transfer.state); + file_transfer.bind_property("state", this, "mark", BindingFlags.DEFAULT, (_, from_value, ref to_value) => { + to_value = file_to_message_state((FileTransfer.State)from_value.get_enum()); + return true; }); } } |