fix(registry): fix incorrect QMultiMap casts

This caused a crash affecting docsets which contained multiple
symbols with identical names and types.
This commit is contained in:
Oleg Shparber 2020-08-02 18:03:06 -04:00
parent 7fa29c9770
commit dc4d476d20
2 changed files with 3 additions and 3 deletions

View File

@ -283,7 +283,7 @@ int Docset::symbolCount(const QString &symbolType) const
return m_symbolCounts.value(symbolType); return m_symbolCounts.value(symbolType);
} }
const QMap<QString, QUrl> &Docset::symbols(const QString &symbolType) const const QMultiMap<QString, QUrl> &Docset::symbols(const QString &symbolType) const
{ {
if (!m_symbols.contains(symbolType)) if (!m_symbols.contains(symbolType))
loadSymbols(symbolType); loadSymbols(symbolType);
@ -483,7 +483,7 @@ void Docset::loadSymbols(const QString &symbolType, const QString &symbolString)
return; return;
} }
QMap<QString, QUrl> &symbols = m_symbols[symbolType]; QMultiMap<QString, QUrl> &symbols = m_symbols[symbolType];
while (m_db->next()) { while (m_db->next()) {
symbols.insert(m_db->value(0).toString(), symbols.insert(m_db->value(0).toString(),
createPageUrl(m_db->value(1).toString(), createPageUrl(m_db->value(1).toString(),

View File

@ -67,7 +67,7 @@ public:
QMap<QString, int> symbolCounts() const; QMap<QString, int> symbolCounts() const;
int symbolCount(const QString &symbolType) const; int symbolCount(const QString &symbolType) const;
const QMap<QString, QUrl> &symbols(const QString &symbolType) const; const QMultiMap<QString, QUrl> &symbols(const QString &symbolType) const;
QList<SearchResult> search(const QString &query, const CancellationToken &token) const; QList<SearchResult> search(const QString &query, const CancellationToken &token) const;
QList<SearchResult> relatedLinks(const QUrl &url) const; QList<SearchResult> relatedLinks(const QUrl &url) const;