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

Merge pull request #5184

Pavel Karelin (1):
      fix: Fix PR #5182. Eliminating the 'new' operator at ToxOptionsWrapper
This commit is contained in:
sudden6 2018-06-23 12:46:42 +02:00
commit 254b861ded
No known key found for this signature in database
GPG Key ID: 279509B499E032B9

View File

@ -123,36 +123,33 @@ namespace {
class ToxOptionsWrapper
{
public:
ToxOptionsWrapper(Tox_Options *options, const QByteArray& proxyAddrData) {
this->options = options;
this->proxyAddrData = new QByteArray(proxyAddrData);
}
ToxOptionsWrapper(Tox_Options *options, const QByteArray& proxyAddrData)
: options(options)
, proxyAddrData(proxyAddrData)
{}
~ToxOptionsWrapper() {
tox_options_free(options);
options = nullptr;
delete proxyAddrData;
proxyAddrData = nullptr;
}
ToxOptionsWrapper (ToxOptionsWrapper && from) {
this->options = from.options;
options = from.options;
proxyAddrData.swap(from.proxyAddrData);
from.options = nullptr;
this->proxyAddrData = from.proxyAddrData;
from.proxyAddrData = nullptr;
from.proxyAddrData.clear();
}
operator Tox_Options* () {
return options;
}
const char* getProxyAddrData() {
return this->proxyAddrData->data();
const char* getProxyAddrData() const {
return proxyAddrData.constData();
}
private:
Tox_Options *options = nullptr;
QByteArray *proxyAddrData = nullptr;
QByteArray proxyAddrData;
};
/**