Skip to content

Commit

Permalink
add include guard to frequency dock access
Browse files Browse the repository at this point in the history
KDDW doesn't like access to non existing elements. This happens if
hotspot is compiled without QCustomPlot. This patches fixes that by
adding an compile time check.

Fixes: #575
  • Loading branch information
lievenhey committed Jan 8, 2024
1 parent 3e877c4 commit 0c14d92
Showing 1 changed file with 20 additions and 8 deletions.
28 changes: 20 additions & 8 deletions src/resultspage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -298,12 +298,15 @@ QMenu* ResultsPage::exportMenu() const

QList<QAction*> ResultsPage::windowActions() const
{
auto ret = QList<QAction*> {m_summaryPageDock->toggleAction(), m_bottomUpDock->toggleAction(),
m_topDownDock->toggleAction(), m_flameGraphDock->toggleAction(),
m_callerCalleeDock->toggleAction(), m_disassemblyDock->toggleAction(),
m_timeLineDock->toggleAction()};
if (m_frequencyDock)
ret.append(m_frequencyDock->toggleAction());
auto ret = QList<QAction*>
{
m_summaryPageDock->toggleAction(), m_bottomUpDock->toggleAction(), m_topDownDock->toggleAction(),
m_flameGraphDock->toggleAction(), m_callerCalleeDock->toggleAction(), m_disassemblyDock->toggleAction(),
m_timeLineDock->toggleAction(),
#if QCustomPlot_FOUND
m_frequencyDock->toggleAction()
#endif
};
return ret;
}

Expand Down Expand Up @@ -334,8 +337,17 @@ void ResultsPage::initDockWidgets(const QVector<CoreDockWidget*>& restored)

Q_ASSERT(restored.contains(summaryPageDock));

const auto docks = {m_bottomUpDock, m_topDownDock, m_flameGraphDock, m_callerCalleeDock,
m_timeLineDock, m_disassemblyDock, m_frequencyDock};
const auto docks = {
m_bottomUpDock,
m_topDownDock,
m_flameGraphDock,
m_callerCalleeDock,
m_timeLineDock,
m_disassemblyDock,
#if QCustomPlot_FOUND
m_frequencyDock
#endif
};
for (auto dock : docks) {
auto dockWidget = toDockWidget(dock);

Expand Down

0 comments on commit 0c14d92

Please sign in to comment.