[education/rkward] rkward/settings: Fix crash due to new/delete mismatch
Thomas Friedrichsmeier
null at kde.org
Fri Mar 18 06:29:13 GMT 2022
Git commit a7fceda9d5917f71cb118937a141eea73700722b by Thomas Friedrichsmeier, on behalf of Waqar Ahmed.
Committed on 18/03/2022 at 06:28.
Pushed by tfry into branch 'master'.
Fix crash due to new/delete mismatch
M +2 -3 rkward/settings/rksettings.cpp
M +1 -1 rkward/settings/rksettings.h
https://invent.kde.org/education/rkward/commit/a7fceda9d5917f71cb118937a141eea73700722b
diff --git a/rkward/settings/rksettings.cpp b/rkward/settings/rksettings.cpp
index b8473c06..1884529f 100644
--- a/rkward/settings/rksettings.cpp
+++ b/rkward/settings/rksettings.cpp
@@ -91,7 +91,7 @@ void RKSettings::dialogClosed () {
settings_dialog = 0;
}
-RKSettings::RKSettings (QWidget *parent) : KPageDialog (parent), pages(nullptr) {
+RKSettings::RKSettings (QWidget *parent) : KPageDialog (parent) {
RK_TRACE (SETTINGS);
setFaceType (KPageDialog::Tree);
@@ -117,7 +117,6 @@ RKSettings::~RKSettings() {
delete *it;
}
modules.clear ();
- delete pages;
dialogClosed ();
}
@@ -141,7 +140,7 @@ void RKSettings::initModules () {
RK_TRACE (SETTINGS);
auto ktexteditorpages = RKSettingsModuleCommandEditor::kateConfigPages(this, 0);
- pages = new KPageWidgetItem*[(NumPages + ktexteditorpages.size())];
+ pages.resize(NumPages + ktexteditorpages.size());
modules.insert (PagePlugins, new RKSettingsModulePlugins (this, 0));
modules.insert (PageKatePlugins, new RKSettingsModuleKatePlugins (this, 0));
modules.insert (PageR, new RKSettingsModuleR (this, 0));
diff --git a/rkward/settings/rksettings.h b/rkward/settings/rksettings.h
index 455bda6d..35490a66 100644
--- a/rkward/settings/rksettings.h
+++ b/rkward/settings/rksettings.h
@@ -82,7 +82,7 @@ private:
typedef QMap<int, RKSettingsModule *> ModuleMap;
ModuleMap modules;
- KPageWidgetItem** pages;
+ std::vector<KPageWidgetItem*> pages;
static RKSettings *settings_dialog;
friend class RKWardMainWindow;
More information about the rkward-tracker
mailing list