ElfReader: Replace QSharedPointer with std::shared_ptr

According to https://wiki.qt.io/Things_To_Look_Out_For_In_Reviews
QSharedPointer impl is poor and it's going to be removed from Qt 7.

Change-Id: I2a4b1c31acdf2f05a952aba2b813d9f2dd8cb3c6
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Jarek Kobus
2024-02-01 11:15:20 +01:00
parent c22d6b501b
commit 3b5e64e8a3
3 changed files with 4 additions and 5 deletions

View File

@@ -283,9 +283,9 @@ ElfReader::Result ElfReader::readIt()
return Ok;
}
QSharedPointer<ElfMapper> ElfReader::readSection(const QByteArray &name)
std::shared_ptr<ElfMapper> ElfReader::readSection(const QByteArray &name)
{
QSharedPointer<ElfMapper> mapper;
std::shared_ptr<ElfMapper> mapper;
readIt();
int i = m_elfData.indexOf(name);
if (i == -1)

View File

@@ -11,7 +11,6 @@
#include <QCoreApplication>
#include <QFile>
#include <QList>
#include <QSharedPointer>
namespace Utils {
@@ -141,7 +140,7 @@ public:
enum Result { Ok, NotElf, Corrupt };
ElfData readHeaders();
QSharedPointer<ElfMapper> readSection(const QByteArray &sectionName);
std::shared_ptr<ElfMapper> readSection(const QByteArray &sectionName);
QString errorString() const { return m_errorString; }
QByteArray readCoreName(bool *isCore);

View File

@@ -2850,7 +2850,7 @@ void CppDebuggerEngine::validateRunParameters(DebuggerRunParameters &rp)
}
if (globalRegExpSourceMap.isEmpty())
return;
if (QSharedPointer<Utils::ElfMapper> mapper = reader.readSection(".debug_str")) {
if (std::shared_ptr<ElfMapper> mapper = reader.readSection(".debug_str")) {
const char *str = mapper->start;
const char *limit = str + mapper->fdlen;
bool found = false;