diff options
author | fiaxh <git@mx.ax.lt> | 2017-08-07 21:44:22 +0200 |
---|---|---|
committer | fiaxh <git@mx.ax.lt> | 2017-08-07 21:48:43 +0200 |
commit | 0206139f0f8a472e6ac63fd0d303b215c88746e2 (patch) | |
tree | 253d34a02f3004e18b4242e00643aab3b6974a12 /plugins | |
parent | 6bc950d042c47982c71ca1f9140ab40d1c727c66 (diff) | |
download | dino-0206139f0f8a472e6ac63fd0d303b215c88746e2.tar.gz dino-0206139f0f8a472e6ac63fd0d303b215c88746e2.zip |
http files: Fix double-free rance-condition
... and move classes around
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/http-files/src/manager.vala | 12 |
1 files changed, 9 insertions, 3 deletions
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); }); } |