From 0206139f0f8a472e6ac63fd0d303b215c88746e2 Mon Sep 17 00:00:00 2001 From: fiaxh Date: Mon, 7 Aug 2017 21:44:22 +0200 Subject: http files: Fix double-free rance-condition ... and move classes around --- plugins/http-files/src/manager.vala | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'plugins/http-files/src') diff --git a/plugins/http-files/src/manager.vala b/plugins/http-files/src/manager.vala index 5b804a00..f398b700 100644 --- a/plugins/http-files/src/manager.vala +++ b/plugins/http-files/src/manager.vala @@ -33,16 +33,22 @@ public class Manager : StreamInteractionModule, Object { } public bool is_upload_available(Account account) { - return max_file_sizes.has_key(account); + lock (max_file_sizes) { + return max_file_sizes.has_key(account); + } } public int? get_max_file_size(Account account) { - return max_file_sizes[account]; + lock (max_file_sizes) { + return max_file_sizes[account]; + } } private void on_stream_negotiated(Account account, Core.XmppStream stream) { stream_interactor.module_manager.get_module(account, UploadStreamModule.IDENTITY).feature_available.connect((stream, max_file_size) => { - max_file_sizes[account] = max_file_size; + lock (max_file_sizes) { + max_file_sizes[account] = max_file_size; + } upload_available(account); }); } -- cgit v1.2.3-70-g09d2