Merge pull request #58 from martensitingale/master

fix memory leak
This commit is contained in:
Bleak Grey 2018-07-08 03:42:23 +03:00 committed by GitHub
commit c4657ea697
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 4 deletions

View File

@ -111,19 +111,23 @@ public class Tootle.ImageCache : GLib.Object {
Soup.Message? msg = in_progress.get(ci);
if (msg == null) {
msg = new Soup.Message("GET", uri);
msg.finished.connect(() => {
ulong id = 0;
id = msg.finished.connect(() => {
debug("Caching %s@%d", uri, size);
var data = msg.response_body.data;
var stream = new MemoryInputStream.from_data (data);
var pixbuf = new Gdk.Pixbuf.from_stream_at_scale (stream, size, size, true);
store_pixbuf(ci, pixbuf);
cb(pixbuf);
msg.disconnect(id);
});
in_progress[ci] = msg;
network.queue_custom (msg);
} else {
msg.finished.connect_after(() => {
ulong id = 0;
id = msg.finished.connect(() => {
cb(pixbufs[ci]);
msg.disconnect(id);
});
}
}

View File

@ -48,8 +48,8 @@ public class Tootle.NotificationWidget : Gtk.Grid {
}
destroy.connect (() => {
if(separator != null)
separator.destroy ();
separator = null;
status_widget = null;
});
if (notification.status != null){