Commit dfcfb426 authored by Christoph Cullmann's avatar Christoph Cullmann 🐮
Browse files

Merge branch 'work/fix-leaks-in-config'

parents fc0ac3f1 b96ca726
......@@ -273,12 +273,12 @@ void KateConfigDialog::addPluginPage(KTextEditor::Plugin *plugin)
item->setHeader(cp->fullName());
item->setIcon(cp->icon());
PluginPageListItem *info = new PluginPageListItem;
info->plugin = plugin;
info->pluginPage = cp;
info->idInPlugin = i;
info->pageWidgetItem = item;
connect(info->pluginPage, &KTextEditor::ConfigPage::changed, this, &KateConfigDialog::slotChanged);
PluginPageListItem info;
info.plugin = plugin;
info.pluginPage = cp;
info.idInPlugin = i;
info.pageWidgetItem = item;
connect(info.pluginPage, &KTextEditor::ConfigPage::changed, this, &KateConfigDialog::slotChanged);
m_pluginPages.insert(item, info);
}
}
......@@ -286,12 +286,10 @@ void KateConfigDialog::addPluginPage(KTextEditor::Plugin *plugin)
void KateConfigDialog::removePluginPage(KTextEditor::Plugin *plugin)
{
QList<KPageWidgetItem *> remove;
for (QHash<KPageWidgetItem *, PluginPageListItem *>::const_iterator it = m_pluginPages.constBegin(); it != m_pluginPages.constEnd(); ++it) {
PluginPageListItem *pli = it.value();
if (!pli) {
continue;
}
if (pli->plugin == plugin) {
for (QHash<KPageWidgetItem *, PluginPageListItem>::const_iterator it = m_pluginPages.constBegin(); it != m_pluginPages.constEnd(); ++it) {
const PluginPageListItem &pli = it.value();
if (pli.plugin == plugin) {
remove.append(it.key());
}
}
......@@ -299,10 +297,15 @@ void KateConfigDialog::removePluginPage(KTextEditor::Plugin *plugin)
qCDebug(LOG_KATE) << remove.count();
while (!remove.isEmpty()) {
KPageWidgetItem *wItem = remove.takeLast();
<<<<<<< HEAD
PluginPageListItem *pItem = m_pluginPages.take(wItem);
delete pItem->pluginPage;
=======
PluginPageListItem item = m_pluginPages.take(wItem);
delete item.pluginPage;
delete item.pageParent;
>>>>>>> work/fix-leaks-in-config
removePage(wItem);
delete pItem;
}
}
......@@ -376,12 +379,9 @@ void KateConfigDialog::slotApply()
#endif
}
for (PluginPageListItem *plugin : qAsConst(m_pluginPages)) {
if (!plugin) {
continue;
}
if (plugin->pluginPage) {
plugin->pluginPage->apply();
for (const PluginPageListItem &plugin : qAsConst(m_pluginPages)) {
if (plugin.pluginPage) {
plugin.pluginPage->apply();
}
}
......@@ -409,9 +409,9 @@ void KateConfigDialog::slotChanged()
void KateConfigDialog::showAppPluginPage(KTextEditor::Plugin *p, int id)
{
for (PluginPageListItem *plugin : qAsConst(m_pluginPages)) {
if ((plugin->plugin == p) && (id == plugin->idInPlugin)) {
setCurrentPage(plugin->pageWidgetItem);
for (const PluginPageListItem &plugin : qAsConst(m_pluginPages)) {
if ((plugin.plugin == p) && (id == plugin.idInPlugin)) {
setCurrentPage(plugin.pageWidgetItem);
break;
}
}
......
......@@ -88,7 +88,7 @@ private:
Ui::SessionConfigWidget sessionConfigUi;
QHash<KPageWidgetItem *, PluginPageListItem *> m_pluginPages;
QHash<KPageWidgetItem *, PluginPageListItem> m_pluginPages;
QList<KTextEditor::ConfigPage *> m_editorPages;
#ifdef WITH_KUSERFEEDBACK
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment