Changeset View
Changeset View
Standalone View
Standalone View
src/filewidgets/kurlnavigatorplacesselector.cpp
Show First 20 Lines • Show All 65 Lines • ▼ Show 20 Line(s) | |||||
66 | KUrlNavigatorPlacesSelector::~KUrlNavigatorPlacesSelector() | 66 | KUrlNavigatorPlacesSelector::~KUrlNavigatorPlacesSelector() | ||
67 | { | 67 | { | ||
68 | } | 68 | } | ||
69 | 69 | | |||
70 | void KUrlNavigatorPlacesSelector::updateMenu() | 70 | void KUrlNavigatorPlacesSelector::updateMenu() | ||
71 | { | 71 | { | ||
72 | m_placesMenu->clear(); | 72 | m_placesMenu->clear(); | ||
73 | 73 | | |||
74 | // Submenus have to be deleted explicitly (QTBUG-11070) | ||||
75 | for(QObject *obj : m_placesMenu->children()) { | ||||
meven: Shouldn't it be done before the call to `m_placesMenu->clear();` | |||||
fvogt: How would that make a difference? | |||||
meven: Misconception on my part, .children() is not affected by .clear() | |||||
76 | delete qobject_cast<QMenu*>(obj); // Noop for nullptr | ||||
anthonyfieroni: Why cast? | |||||
fvogt: To only delete submenus, not anything else. | |||||
77 | } | ||||
78 | | ||||
74 | updateSelection(m_selectedUrl); | 79 | updateSelection(m_selectedUrl); | ||
75 | 80 | | |||
76 | QString previousGroup; | 81 | QString previousGroup; | ||
77 | QMenu *subMenu = nullptr; | 82 | QMenu *subMenu = nullptr; | ||
78 | 83 | | |||
79 | const int rowCount = m_placesModel->rowCount(); | 84 | const int rowCount = m_placesModel->rowCount(); | ||
80 | for (int i = 0; i < rowCount; ++i) { | 85 | for (int i = 0; i < rowCount; ++i) { | ||
81 | QModelIndex index = m_placesModel->index(i, 0); | 86 | QModelIndex index = m_placesModel->index(i, 0); | ||
▲ Show 20 Lines • Show All 217 Lines • Show Last 20 Lines |
Shouldn't it be done before the call to m_placesMenu->clear();