summaryrefslogtreecommitdiffstats
path: root/qmake/library/proitems.h
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@qt.io>2017-08-14 18:30:29 +0200
committerSimon Hausmann <simon.hausmann@qt.io>2017-08-15 10:54:50 +0000
commit190aa94be7f5e146bef44862b974d733755cec85 (patch)
treef347424990930691ebc2b9cd39794ae74984f8f5 /qmake/library/proitems.h
parente6fad35155a25a932386ad6f8421efd74404ac7f (diff)
Change source identifier type in ProString
The strings remember in which file they were created/assigned. However, this used a non-counting reference to a ProFile, which could become dangling. If a subsequent ProFile re-used the exact same address, a string's source would be mis-identified, which would be fatal in conjunction with discard_from(). Since we actually need only a unique id for comparison, let's use an integer for that. Task-number: QTBUG-62434 Started-by: Simon Hausmann <simon.hausmann@qt.io> Change-Id: I395153afaf7c835d0119690ee7f4b915e6f90d4a Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'qmake/library/proitems.h')
-rw-r--r--qmake/library/proitems.h10
1 files changed, 6 insertions, 4 deletions
diff --git a/qmake/library/proitems.h b/qmake/library/proitems.h
index c81e205699..6ce8c98789 100644
--- a/qmake/library/proitems.h
+++ b/qmake/library/proitems.h
@@ -73,8 +73,8 @@ public:
void setValue(const QString &str);
void clear() { m_string.clear(); m_length = 0; }
ProString &setSource(const ProString &other) { m_file = other.m_file; return *this; }
- ProString &setSource(const ProFile *pro) { m_file = pro; return *this; }
- const ProFile *sourceFile() const { return m_file; }
+ ProString &setSource(int id) { m_file = id; return *this; }
+ int sourceFile() const { return m_file; }
ProString &prepend(const ProString &other);
ProString &append(const ProString &other, bool *pending = 0);
@@ -163,7 +163,7 @@ private:
QString m_string;
int m_offset, m_length;
- const ProFile *m_file;
+ int m_file;
mutable uint m_hash;
QChar *prepareExtend(int extraLen, int thisTarget, int extraTarget);
uint updatedHash() const;
@@ -340,9 +340,10 @@ enum ProToken {
class QMAKE_EXPORT ProFile
{
public:
- explicit ProFile(const QString &fileName);
+ ProFile(int id, const QString &fileName);
~ProFile();
+ int id() const { return m_id; }
QString fileName() const { return m_fileName; }
QString directoryName() const { return m_directoryName; }
const QString &items() const { return m_proitems; }
@@ -367,6 +368,7 @@ private:
QString m_proitems;
QString m_fileName;
QString m_directoryName;
+ int m_id;
bool m_ok;
bool m_hostBuild;
};