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:
commit
254b861ded
|
@ -123,36 +123,33 @@ namespace {
|
||||||
class ToxOptionsWrapper
|
class ToxOptionsWrapper
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ToxOptionsWrapper(Tox_Options *options, const QByteArray& proxyAddrData) {
|
ToxOptionsWrapper(Tox_Options *options, const QByteArray& proxyAddrData)
|
||||||
this->options = options;
|
: options(options)
|
||||||
this->proxyAddrData = new QByteArray(proxyAddrData);
|
, proxyAddrData(proxyAddrData)
|
||||||
}
|
{}
|
||||||
|
|
||||||
~ToxOptionsWrapper() {
|
~ToxOptionsWrapper() {
|
||||||
tox_options_free(options);
|
tox_options_free(options);
|
||||||
options = nullptr;
|
|
||||||
delete proxyAddrData;
|
|
||||||
proxyAddrData = nullptr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ToxOptionsWrapper (ToxOptionsWrapper && from) {
|
ToxOptionsWrapper (ToxOptionsWrapper && from) {
|
||||||
this->options = from.options;
|
options = from.options;
|
||||||
|
proxyAddrData.swap(from.proxyAddrData);
|
||||||
from.options = nullptr;
|
from.options = nullptr;
|
||||||
this->proxyAddrData = from.proxyAddrData;
|
from.proxyAddrData.clear();
|
||||||
from.proxyAddrData = nullptr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
operator Tox_Options* () {
|
operator Tox_Options* () {
|
||||||
return options;
|
return options;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* getProxyAddrData() {
|
const char* getProxyAddrData() const {
|
||||||
return this->proxyAddrData->data();
|
return proxyAddrData.constData();
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Tox_Options *options = nullptr;
|
Tox_Options *options = nullptr;
|
||||||
QByteArray *proxyAddrData = nullptr;
|
QByteArray proxyAddrData;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue
Block a user