mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-08-26 08:05:11 -07:00
Partially revert e93c360db6
QShareDataPointer causes a crash upon start on 32bit Qt5 Windows. This is a temporary fix in order to release v4.4.1.
This commit is contained in:
parent
a75ae21434
commit
0a4971c994
1 changed files with 12 additions and 19 deletions
|
@ -32,8 +32,6 @@
|
||||||
|
|
||||||
#include <QByteArray>
|
#include <QByteArray>
|
||||||
#include <QHash>
|
#include <QHash>
|
||||||
#include <QSharedData>
|
|
||||||
#include <QSharedDataPointer>
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
template <int N>
|
template <int N>
|
||||||
|
@ -45,11 +43,11 @@ public:
|
||||||
Digest32() = default;
|
Digest32() = default;
|
||||||
|
|
||||||
Digest32(const UnderlyingType &nativeDigest)
|
Digest32(const UnderlyingType &nativeDigest)
|
||||||
|
: m_valid {true}
|
||||||
|
, m_nativeDigest {nativeDigest}
|
||||||
{
|
{
|
||||||
m_dataPtr->valid = true;
|
|
||||||
m_dataPtr->nativeDigest = nativeDigest;
|
|
||||||
const QByteArray raw = QByteArray::fromRawData(nativeDigest.data(), length());
|
const QByteArray raw = QByteArray::fromRawData(nativeDigest.data(), length());
|
||||||
m_dataPtr->hashString = QString::fromLatin1(raw.toHex());
|
m_hashString = QString::fromLatin1(raw.toHex());
|
||||||
}
|
}
|
||||||
|
|
||||||
static constexpr int length()
|
static constexpr int length()
|
||||||
|
@ -59,12 +57,12 @@ public:
|
||||||
|
|
||||||
bool isValid() const
|
bool isValid() const
|
||||||
{
|
{
|
||||||
return m_dataPtr->valid;
|
return m_valid;
|
||||||
}
|
}
|
||||||
|
|
||||||
operator UnderlyingType() const
|
operator UnderlyingType() const
|
||||||
{
|
{
|
||||||
return m_dataPtr->nativeDigest;
|
return m_nativeDigest;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Digest32 fromString(const QString &digestString)
|
static Digest32 fromString(const QString &digestString)
|
||||||
|
@ -77,27 +75,22 @@ public:
|
||||||
return {};
|
return {};
|
||||||
|
|
||||||
Digest32 result;
|
Digest32 result;
|
||||||
result.m_dataPtr->valid = true;
|
result.m_valid = true;
|
||||||
result.m_dataPtr->hashString = digestString;
|
result.m_hashString = digestString;
|
||||||
result.m_dataPtr->nativeDigest.assign(raw.constData());
|
result.m_nativeDigest.assign(raw.constData());
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString toString() const
|
QString toString() const
|
||||||
{
|
{
|
||||||
return m_dataPtr->hashString;
|
return m_hashString;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct Data : public QSharedData
|
bool m_valid = false;
|
||||||
{
|
UnderlyingType m_nativeDigest;
|
||||||
bool valid = false;
|
QString m_hashString;
|
||||||
UnderlyingType nativeDigest;
|
|
||||||
QString hashString;
|
|
||||||
};
|
|
||||||
|
|
||||||
QSharedDataPointer<Data> m_dataPtr {new Data};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
template <int N>
|
template <int N>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue