diff --git a/launcher/minecraft/auth/AccountTask.cpp b/launcher/minecraft/auth/AccountTask.cpp index 49b6e46fc..4118c3c5d 100644 --- a/launcher/minecraft/auth/AccountTask.cpp +++ b/launcher/minecraft/auth/AccountTask.cpp @@ -79,6 +79,8 @@ QString AccountTask::getStateMessage() const bool AccountTask::changeState(AccountTaskState newState, QString reason) { m_taskState = newState; + // FIXME: virtual method invoked in constructor. + // We want that behavior, but maybe make it less weird? setStatus(getStateMessage()); switch(newState) { case AccountTaskState::STATE_CREATED: { diff --git a/launcher/modplatform/flame/FlameAPI.h b/launcher/modplatform/flame/FlameAPI.h index 424153d28..aea76ff19 100644 --- a/launcher/modplatform/flame/FlameAPI.h +++ b/launcher/modplatform/flame/FlameAPI.h @@ -59,7 +59,7 @@ class FlameAPI : public NetworkModAPI { }; public: - static auto getMappedModLoader(const ModLoaderTypes loaders) -> const int + static auto getMappedModLoader(const ModLoaderTypes loaders) -> int { // https://docs.curseforge.com/?http#tocS_ModLoaderType if (loaders & Forge) diff --git a/launcher/translations/POTranslator.cpp b/launcher/translations/POTranslator.cpp index 1ffcb9a40..c77ae45d3 100644 --- a/launcher/translations/POTranslator.cpp +++ b/launcher/translations/POTranslator.cpp @@ -329,6 +329,11 @@ POTranslator::POTranslator(const QString& filename, QObject* parent) : QTranslat d->reload(); } +POTranslator::~POTranslator() +{ + delete d; +} + QString POTranslator::translate(const char* context, const char* sourceText, const char* disambiguation, int n) const { if(disambiguation) diff --git a/launcher/translations/POTranslator.h b/launcher/translations/POTranslator.h index 6d5185601..1634018cc 100644 --- a/launcher/translations/POTranslator.h +++ b/launcher/translations/POTranslator.h @@ -9,6 +9,7 @@ class POTranslator : public QTranslator Q_OBJECT public: explicit POTranslator(const QString& filename, QObject * parent = nullptr); + virtual ~POTranslator(); QString translate(const char * context, const char * sourceText, const char * disambiguation, int n) const override; bool isEmpty() const override; private: diff --git a/libraries/LocalPeer/src/LocalPeer.cpp b/libraries/LocalPeer/src/LocalPeer.cpp index cb218466f..2c996ae78 100644 --- a/libraries/LocalPeer/src/LocalPeer.cpp +++ b/libraries/LocalPeer/src/LocalPeer.cpp @@ -162,15 +162,15 @@ bool LocalPeer::sendMessage(const QByteArray &message, int timeout) QLocalSocket socket; bool connOk = false; - for(int i = 0; i < 2; i++) { + int tries = 2; + for(int i = 0; i < tries; i++) { // Try twice, in case the other instance is just starting up socket.connectToServer(socketName); connOk = socket.waitForConnected(timeout/2); - if (connOk || i) + if (!connOk && i < (tries - 1)) { - break; + std::this_thread::sleep_for(std::chrono::milliseconds(250)); } - std::this_thread::sleep_for(std::chrono::milliseconds(250)); } if (!connOk) { diff --git a/libraries/classparser/src/annotations.cpp b/libraries/classparser/src/annotations.cpp index 18a9e880a..89b201bc8 100644 --- a/libraries/classparser/src/annotations.cpp +++ b/libraries/classparser/src/annotations.cpp @@ -79,7 +79,7 @@ element_value *element_value::readElementValue(util::membuffer &input, } return new element_value_array(ARRAY, vals, pool); default: - throw new java::classfile_exception(); + throw java::classfile_exception(); } } -} \ No newline at end of file +} diff --git a/libraries/classparser/src/classfile.h b/libraries/classparser/src/classfile.h index 1616a828e..d629dde1f 100644 --- a/libraries/classparser/src/classfile.h +++ b/libraries/classparser/src/classfile.h @@ -17,7 +17,7 @@ public: is_synthetic = false; read_be(magic); if (magic != 0xCAFEBABE) - throw new classfile_exception(); + throw classfile_exception(); read_be(minor_version); read_be(major_version); constants.load(*this); @@ -153,4 +153,4 @@ public: // FIXME: doesn't free up memory on delete java::annotation_table visible_class_annotations; }; -} \ No newline at end of file +} diff --git a/libraries/classparser/src/constants.h b/libraries/classparser/src/constants.h index 3b6c3b7ae..47b325b93 100644 --- a/libraries/classparser/src/constants.h +++ b/libraries/classparser/src/constants.h @@ -1,5 +1,6 @@ #pragma once #include "errors.h" +#include "membuffer.h" #include namespace java @@ -90,7 +91,7 @@ public: break; default: // invalid constant type! - throw new classfile_exception(); + throw classfile_exception(); } } constant(int) @@ -210,7 +211,7 @@ public: { if (constant_index == 0 || constant_index > constants.size()) { - throw new classfile_exception(); + throw classfile_exception(); } return constants[constant_index - 1]; }