[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [kexi] src/widget/navigator: KexiItemMenu: Remove possible nullptr dereference
From: Jaroslaw Staniek <staniek () kde ! org>
Date: 2016-02-29 23:12:13
Message-ID: E1aaWz7-0000sv-8d () scm ! kde ! org
[Download RAW message or body]
Git commit cd1668f509d80efec59b48cb3403a04240e64ee8 by Jaroslaw Staniek.
Committed on 29/02/2016 at 23:07.
Pushed by staniek into branch 'master'.
KexiItemMenu: Remove possible nullptr dereference
CID #1353974
M +13 -11 src/widget/navigator/KexiProjectNavigator.cpp
M +1 -1 src/widget/navigator/KexiProjectNavigator.h
http://commits.kde.org/kexi/cd1668f509d80efec59b48cb3403a04240e64ee8
diff --git a/src/widget/navigator/KexiProjectNavigator.cpp \
b/src/widget/navigator/KexiProjectNavigator.cpp index b8e5e93..f3501d5 100644
--- a/src/widget/navigator/KexiProjectNavigator.cpp
+++ b/src/widget/navigator/KexiProjectNavigator.cpp
@@ -303,7 +303,9 @@ void KexiProjectNavigator::contextMenuEvent(QContextMenuEvent* \
event) if (bit->partItem()) {
pm = d->itemMenu;
KexiProjectModelItem *par_it = \
static_cast<KexiProjectModelItem*>(bit->parent());
- d->itemMenu->update(par_it->partInfo(), bit->partItem());
+ if (par_it->partInfo() && bit->partItem()) {
+ d->itemMenu->update(*par_it->partInfo(), *bit->partItem());
+ }
}
if (pm) {
pm->exec(event->globalPos());
@@ -697,26 +699,26 @@ KexiItemMenu::~KexiItemMenu()
{
}
-void KexiItemMenu::update(KexiPart::Info* partInfo, KexiPart::Item* partItem)
+void KexiItemMenu::update(const KexiPart::Info& partInfo, const KexiPart::Item& \
partItem) {
clear();
addSection(QString());
- KexiContextMenuUtils::updateTitle(this, partItem->name(), partInfo->name(),
- KexiIconName(partInfo->iconName()));
+ KexiContextMenuUtils::updateTitle(this, partItem.name(), partInfo.name(),
+ KexiIconName(partInfo.iconName()));
if (m_actionCollection->action("open_object")
&& m_actionCollection->action("open_object")->isEnabled()
- && partItem && (partInfo->supportedViewModes() & Kexi::DataViewMode)) {
+ && (partInfo.supportedViewModes() & Kexi::DataViewMode)) {
addAction("open_object");
}
if (m_actionCollection->action("design_object")
&& m_actionCollection->action("design_object")->isEnabled()
- && partItem && (partInfo->supportedViewModes() & Kexi::DesignViewMode)) \
{ + && (partInfo.supportedViewModes() & Kexi::DesignViewMode)) {
addAction("design_object");
}
if (m_actionCollection->action("editText_object")
&& m_actionCollection->action("editText_object")->isEnabled()
- && partItem && (partInfo->supportedViewModes() & Kexi::TextViewMode)) {
+ && (partInfo.supportedViewModes() & Kexi::TextViewMode)) {
addAction("editText_object");
}
addSeparator();
@@ -727,11 +729,11 @@ void KexiItemMenu::update(KexiPart::Info* partInfo, \
KexiPart::Item* partItem) //! @todo addSeparator();
#endif
bool addSep = false;
- if (partItem && partInfo->isExecuteSupported()) {
+ if (partInfo.isExecuteSupported()) {
addAction("data_execute");
addSep = true;
}
- if (partItem && partInfo->isDataExportSupported()) {
+ if (partInfo.isDataExportSupported()) {
addAction("export_object");
addSep = true;
}
@@ -739,9 +741,9 @@ void KexiItemMenu::update(KexiPart::Info* partInfo, \
KexiPart::Item* partItem) addSeparator();
#ifdef KEXI_QUICK_PRINTING_SUPPORT
- if (partItem && partInfo->isPrintingSupported())
+ if (partInfo.isPrintingSupported())
addAction("print_object");
- if (partItem && partInfo->isPrintingSupported())
+ if (partInfo.isPrintingSupported())
addAction("pageSetupForObject");
if (m_actionCollection->action("edit_rename") || \
m_actionCollection->action("edit_delete")) addSeparator();
diff --git a/src/widget/navigator/KexiProjectNavigator.h \
b/src/widget/navigator/KexiProjectNavigator.h index cc47d33..6d4fd12 100644
--- a/src/widget/navigator/KexiProjectNavigator.h
+++ b/src/widget/navigator/KexiProjectNavigator.h
@@ -63,7 +63,7 @@ public:
//! Rebuilds the menu entirely using information obtained from \a partInfo
//! and \a partItem.
- void update(KexiPart::Info* partInfo, KexiPart::Item* partItem);
+ void update(const KexiPart::Info& partInfo, const KexiPart::Item& partItem);
};
/*! @internal */
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic