aboutsummaryrefslogtreecommitdiff
path: root/libdino/src/service
diff options
context:
space:
mode:
authorhrxi <hrrrxi@gmail.com>2019-07-22 21:37:47 +0200
committerhrxi <hrrrxi@gmail.com>2019-08-05 17:17:17 +0200
commit308d71b70325917e60dc0750f44bee9f2d58a1a4 (patch)
tree31c177710eec3eb8a28df53e6cbd04e0850189d7 /libdino/src/service
parent7fe6dda4c9bbc2da189c3818d233e3aa43c363b2 (diff)
downloaddino-308d71b70325917e60dc0750f44bee9f2d58a1a4.tar.gz
dino-308d71b70325917e60dc0750f44bee9f2d58a1a4.zip
Close files involved in file transfers explicitly
Diffstat (limited to 'libdino/src/service')
-rw-r--r--libdino/src/service/file_manager.vala6
1 files changed, 2 insertions, 4 deletions
diff --git a/libdino/src/service/file_manager.vala b/libdino/src/service/file_manager.vala
index 50b38f01..5b89d1c2 100644
--- a/libdino/src/service/file_manager.vala
+++ b/libdino/src/service/file_manager.vala
@@ -269,8 +269,7 @@ public class FileManager : StreamInteractionModule, Object {
}
OutputStream os = file.create(FileCreateFlags.REPLACE_DESTINATION);
- yield os.splice_async(input_stream, 0);
- os.close();
+ yield os.splice_async(input_stream, OutputStreamSpliceFlags.CLOSE_SOURCE|OutputStreamSpliceFlags.CLOSE_TARGET);
file_transfer.size = (int)file_meta.size;
file_transfer.file_name = file_meta.file_name;
file_transfer.path = file.get_basename();
@@ -327,8 +326,7 @@ public class FileManager : StreamInteractionModule, Object {
string filename = Random.next_int().to_string("%x") + "_" + file_transfer.file_name;
File file = File.new_for_path(Path.build_filename(get_storage_dir(), filename));
OutputStream os = file.create(FileCreateFlags.REPLACE_DESTINATION);
- yield os.splice_async(file_transfer.input_stream, 0);
- os.close();
+ yield os.splice_async(file_transfer.input_stream, OutputStreamSpliceFlags.CLOSE_SOURCE|OutputStreamSpliceFlags.CLOSE_TARGET);
file_transfer.state = FileTransfer.State.COMPLETE;
file_transfer.path = filename;
file_transfer.input_stream = yield file.read_async();