diff --git a/src/core.cpp b/src/core.cpp index b6b5d9b78..0f3204884 100644 --- a/src/core.cpp +++ b/src/core.cpp @@ -39,6 +39,7 @@ #include #include #include +#include const QString Core::CONFIG_FILE_NAME = "data"; const QString Core::TOX_EXT = ".tox"; @@ -768,6 +769,8 @@ void Core::sendGroupMessage(int groupId, const QString& message) void Core::sendFile(int32_t friendId, QString Filename, QString FilePath, long long filesize) { + QMutexLocker mlocker(&fileSendMutex); + QByteArray fileName = Filename.toUtf8(); int fileNum = tox_new_file_sender(tox, friendId, filesize, (uint8_t*)fileName.data(), fileName.size()); if (fileNum == -1) diff --git a/src/core.h b/src/core.h index 301b8525a..8d3821993 100644 --- a/src/core.h +++ b/src/core.h @@ -19,6 +19,7 @@ #include #include +#include #include "corestructs.h" #include "coreav.h" @@ -253,6 +254,7 @@ private: int dhtServerId; static QList fileSendQueue, fileRecvQueue; static ToxCall calls[]; + QMutex fileSendMutex; uint8_t* pwsaltedkeys[PasswordType::ptCounter]; // use the pw's hash as the "pw"