Commit 25fcfd5b authored by Guillaume Roguez's avatar Guillaume Roguez Committed by Anthony Léonard

datatransfer: fix deadlock

Mutex deadlock occuring during file transfer creation.
Exchanging some calls to fix the situation.

Change-Id: I2f0108e63e89a13e3f6f2c1b1e096fbf9a6a1290
Reviewed-by: default avatarOlivier Soldano <olivier.soldano@savoirfairelinux.com>
parent 4dee3af5
......@@ -319,9 +319,9 @@ std::shared_ptr<DataTransfer>
DataTransferFacade::Impl::createFileTransfer(const std::string& file_path,
const std::string& display_name)
{
std::lock_guard<std::mutex> lk {mapMutex_};
auto id = generateUID();
auto transfer = std::make_shared<FileTransfer>(id, file_path, display_name);
std::lock_guard<std::mutex> lk {mapMutex_};
map_.emplace(id, transfer);
return transfer;
}
......@@ -330,9 +330,9 @@ std::shared_ptr<IncomingFileTransfer>
DataTransferFacade::Impl::createIncomingFileTransfer(const std::string& display_name,
std::size_t offset)
{
std::lock_guard<std::mutex> lk {mapMutex_};
auto id = generateUID();
auto transfer = std::make_shared<IncomingFileTransfer>(id, display_name, offset);
std::lock_guard<std::mutex> lk {mapMutex_};
map_.emplace(id, transfer);
return transfer;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment