[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [kexi] src/formeditor: KexiActionSelectionDialog: Fix potential nullptr dereferences, add some const
From: Jaroslaw Staniek <staniek () kde ! org>
Date: 2016-02-29 23:12:15
Message-ID: E1aaWz9-0000sv-2Z () scm ! kde ! org
[Download RAW message or body]
Git commit a4ab0f863d7669603c6fb0c0eab0215fe87eeef2 by Jaroslaw Staniek.
Committed on 29/02/2016 at 23:07.
Pushed by staniek into branch 'master'.
KexiActionSelectionDialog: Fix potential nullptr dereferences, add some constness
CID #1354181
M +14 -9 src/formeditor/kexiactionselectiondialog.cpp
http://commits.kde.org/kexi/a4ab0f863d7669603c6fb0c0eab0215fe87eeef2
diff --git a/src/formeditor/kexiactionselectiondialog.cpp \
b/src/formeditor/kexiactionselectiondialog.cpp index bc7ae84..3322638 100644
--- a/src/formeditor/kexiactionselectiondialog.cpp
+++ b/src/formeditor/kexiactionselectiondialog.cpp
@@ -68,7 +68,8 @@ public:
}
using QTreeWidgetItem::data;
- QVariant data(ActionRole role) {
+ QVariant data(ActionRole role) const
+ {
return QTreeWidgetItem::data(0, role);
};
@@ -77,7 +78,7 @@ public:
QTreeWidgetItem::setData(0, role, value);
}
- QIcon icon() {
+ QIcon icon() const {
return QTreeWidgetItem::icon(0);
}
@@ -715,25 +716,29 @@ KexiFormEventAction::ActionData \
KexiActionSelectionDialog::currentAction() const
ActionSelectorDialogTreeItem *categoryItm = \
dynamic_cast<ActionSelectorDialogTreeItem*>(d->actionCategoriesListView->currentItem());
if (categoryItm) {
- QString actionCategory = \
categoryItm->data(ActionSelectorDialogTreeItem::ActionCategoryRole).toString(); + \
const QString actionCategory = \
categoryItm->data(ActionSelectorDialogTreeItem::ActionCategoryRole).toString();
if (actionCategory == "kaction") {
- if (d->kactionListView->currentItem()) {
+ const ActionSelectorDialogTreeItem* actionToExecute = \
dynamic_cast<ActionSelectorDialogTreeItem*>( + \
d->kactionListView->currentItem()); + if (actionToExecute) {
data.string = QString("kaction:")
- + dynamic_cast<ActionSelectorDialogTreeItem*>(d->kactionListView->currentItem())->data(ActionSelectorDialogTreeItem::ActionDataRole).toString();
+ + \
actionToExecute->data(ActionSelectorDialogTreeItem::ActionDataRole).toString(); \
return data; }
} else if (actionCategory == "currentForm") {
- if (d->currentFormActionsListView->currentItem()) {
+ const ActionSelectorDialogTreeItem *actionToExecute = \
dynamic_cast<ActionSelectorDialogTreeItem*>( + \
d->currentFormActionsListView->currentItem()); + if (actionToExecute) {
data.string = QString("currentForm:")
- + dynamic_cast<ActionSelectorDialogTreeItem*>(
- \
d->currentFormActionsListView->currentItem())->data(ActionSelectorDialogTreeItem::ActionDataRole).toString();
+ + \
actionToExecute->data(ActionSelectorDialogTreeItem::ActionDataRole).toString(); \
return data; }
} else if (actionCategory == "noaction") {
return data;
} else if (actionCategory == "navObject") {
- ActionSelectorDialogTreeItem *actionToExecute = \
dynamic_cast<ActionSelectorDialogTreeItem*>(d->actionToExecuteListView->currentItem());
+ const ActionSelectorDialogTreeItem *actionToExecute = \
dynamic_cast<ActionSelectorDialogTreeItem*>( + \
d->actionToExecuteListView->currentItem());
if (d->objectsListView && actionToExecute && \
!actionToExecute->data(ActionSelectorDialogTreeItem::ActionDataRole).toString().isEmpty()) \
{
KexiPart::Item* partItem = d->objectsListView->selectedPartItem();
KexiPart::Info* partInfo = partItem ? \
Kexi::partManager().infoForPluginId(partItem->pluginId()) : 0;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic