1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

chore(cleanup): don't explicitly initialize std::unique_ptr to nullptr

Fix #6009
This commit is contained in:
Anthony Bilinski 2020-03-17 03:14:49 -07:00
parent 2c1a86482a
commit f756dbae2a
No known key found for this signature in database
GPG Key ID: 2AA8E0DA1B31FB3C
8 changed files with 10 additions and 12 deletions

View File

@ -475,7 +475,6 @@ bool parseErr(Tox_Err_Conference_Delete error, int line)
Core::Core(QThread* coreThread) Core::Core(QThread* coreThread)
: tox(nullptr) : tox(nullptr)
, av(nullptr)
, toxTimer{new QTimer{this}} , toxTimer{new QTimer{this}}
, coreThread(coreThread) , coreThread(coreThread)
{ {

View File

@ -251,7 +251,7 @@ private:
// recursive, since we might call our own functions // recursive, since we might call our own functions
mutable QMutex coreLoopLock{QMutex::Recursive}; mutable QMutex coreLoopLock{QMutex::Recursive};
std::unique_ptr<QThread> coreThread = nullptr; std::unique_ptr<QThread> coreThread;
}; };
#endif // CORE_HPP #endif // CORE_HPP

View File

@ -84,7 +84,7 @@ protected:
QMetaObject::Connection videoInConn; QMetaObject::Connection videoInConn;
bool videoEnabled{false}; bool videoEnabled{false};
bool nullVideoBitrate{false}; bool nullVideoBitrate{false};
std::unique_ptr<IAudioSource> audioSource = nullptr; std::unique_ptr<IAudioSource> audioSource;
}; };
class ToxFriendCall : public ToxCall class ToxFriendCall : public ToxCall
@ -109,7 +109,7 @@ private slots:
private: private:
QMetaObject::Connection audioSinkInvalid; QMetaObject::Connection audioSinkInvalid;
TOXAV_FRIEND_CALL_STATE state{TOXAV_FRIEND_CALL_STATE_NONE}; TOXAV_FRIEND_CALL_STATE state{TOXAV_FRIEND_CALL_STATE_NONE};
std::unique_ptr<IAudioSink> sink = nullptr; std::unique_ptr<IAudioSink> sink;
uint32_t friendId; uint32_t friendId;
}; };

View File

@ -73,7 +73,7 @@ enum class CreateToxDataError
std::unique_ptr<ToxEncrypt> loadToxData(const QString& password, const QString& filePath, std::unique_ptr<ToxEncrypt> loadToxData(const QString& password, const QString& filePath,
QByteArray& data, LoadToxDataError& error) QByteArray& data, LoadToxDataError& error)
{ {
std::unique_ptr<ToxEncrypt> tmpKey = nullptr; std::unique_ptr<ToxEncrypt> tmpKey;
qint64 fileSize = 0; qint64 fileSize = 0;
QFile saveFile(filePath); QFile saveFile(filePath);
@ -133,7 +133,7 @@ fail:
std::unique_ptr<ToxEncrypt> createToxData(const QString& name, const QString& password, std::unique_ptr<ToxEncrypt> createToxData(const QString& name, const QString& password,
const QString& filePath, CreateToxDataError& error) const QString& filePath, CreateToxDataError& error)
{ {
std::unique_ptr<ToxEncrypt> newKey{nullptr}; std::unique_ptr<ToxEncrypt> newKey;
if (!password.isEmpty()) { if (!password.isEmpty()) {
newKey = ToxEncrypt::makeToxEncrypt(password); newKey = ToxEncrypt::makeToxEncrypt(password);
if (!newKey) { if (!newKey) {

View File

@ -109,9 +109,9 @@ private:
void initCore(const QByteArray& toxsave, const ICoreSettings& s, bool isNewProfile); void initCore(const QByteArray& toxsave, const ICoreSettings& s, bool isNewProfile);
private: private:
std::unique_ptr<Core> core = nullptr; std::unique_ptr<Core> core;
QString name; QString name;
std::unique_ptr<ToxEncrypt> passkey = nullptr; std::unique_ptr<ToxEncrypt> passkey;
std::shared_ptr<RawDatabase> database; std::shared_ptr<RawDatabase> database;
std::shared_ptr<History> history; std::shared_ptr<History> history;
bool isRemoved; bool isRemoved;

View File

@ -104,8 +104,8 @@ private:
IVideoSettings* videoSettings; IVideoSettings* videoSettings;
bool subscribedToAudioIn; bool subscribedToAudioIn;
std::unique_ptr<IAudioSink> audioSink = nullptr; std::unique_ptr<IAudioSink> audioSink;
std::unique_ptr<IAudioSource> audioSrc = nullptr; std::unique_ptr<IAudioSource> audioSrc;
VideoSurface* camVideoSurface; VideoSurface* camVideoSurface;
CameraSource& camera; CameraSource& camera;
QVector<QPair<QString, QString>> videoDeviceList; QVector<QPair<QString, QString>> videoDeviceList;

View File

@ -139,7 +139,6 @@ Widget* Widget::instance{nullptr};
Widget::Widget(IAudioControl& audio, QWidget* parent) Widget::Widget(IAudioControl& audio, QWidget* parent)
: QMainWindow(parent) : QMainWindow(parent)
, icon{nullptr}
, trayMenu{nullptr} , trayMenu{nullptr}
, ui(new Ui::MainWindow) , ui(new Ui::MainWindow)
, activeChatroomWidget{nullptr} , activeChatroomWidget{nullptr}

View File

@ -328,7 +328,7 @@ private:
int icon_size; int icon_size;
IAudioControl& audio; IAudioControl& audio;
std::unique_ptr<IAudioSink> audioNotification = nullptr; std::unique_ptr<IAudioSink> audioNotification;
Settings& settings; Settings& settings;
QMap<ToxPk, FriendWidget*> friendWidgets; QMap<ToxPk, FriendWidget*> friendWidgets;