Commit c2d02242 authored by Huff, Israel's avatar Huff, Israel
Browse files

- replaced all instances of unique_ptr with standard pointers to address Fortify issues

parent 0772a90d
Pipeline #70551 passed with stages
in 16 minutes and 38 seconds
......@@ -16,15 +16,13 @@ class NavigationActionManager::PImpl
~PImpl();
};
NavigationActionManager::PImpl::~PImpl() {}
NavigationActionManager::NavigationActionManager(QObject *parent)
: QObject(parent)
, p(new PImpl(), deleter)
, p(new PImpl)
{
}
void NavigationActionManager::deleter(PImpl *impl) { delete impl; }
NavigationActionManager::~NavigationActionManager() { delete p; }
void NavigationActionManager::registerAction(NavigationItem *item, QString text,
std::function<void()> functor)
......
......@@ -17,6 +17,7 @@ class RADIX_PUBLIC NavigationActionManager : public QObject
Q_OBJECT
public:
NavigationActionManager(QObject *parent = nullptr);
~NavigationActionManager();
void registerAction(NavigationItem *item, QString text,
std::function<void()> functor);
......@@ -24,8 +25,7 @@ class RADIX_PUBLIC NavigationActionManager : public QObject
private:
class PImpl;
std::unique_ptr<PImpl, void (*)(PImpl *)> p;
static void deleter(PImpl *impl);
PImpl *p;
};
} // namespace radix
......
......@@ -19,26 +19,26 @@ class NavigationItem::PImpl
NavigationItem::PImpl::~PImpl() { qDeleteAll(children); }
NavigationItem::NavigationItem(QVariant data, NavigationItem *parentItem)
: p(new PImpl(), deleter)
: p(new PImpl())
{
p->parent = parentItem;
p->data.append(data);
}
NavigationItem::NavigationItem(QList<QVariant> data, NavigationItem *parentItem)
: p(new PImpl(), deleter)
: p(new PImpl())
{
p->parent = parentItem;
p->data = data;
}
NavigationItem::NavigationItem(NavigationItem *parentItem)
: p(new PImpl(), deleter)
: p(new PImpl())
{
p->parent = parentItem;
}
void NavigationItem::deleter(PImpl *impl) { delete impl; }
NavigationItem::~NavigationItem() { delete p; }
int NavigationItem::type() const { return p->type; }
......
......@@ -13,6 +13,7 @@ class RADIX_PUBLIC NavigationItem
NavigationItem(QVariant data, NavigationItem *parentItem = nullptr);
NavigationItem(QList<QVariant> data, NavigationItem *parentItem = nullptr);
NavigationItem(NavigationItem *parentItem = nullptr);
~NavigationItem();
int type() const;
void setType(int type);
......@@ -29,8 +30,7 @@ class RADIX_PUBLIC NavigationItem
private:
class PImpl;
std::unique_ptr<PImpl, void (*)(PImpl *)> p;
static void deleter(PImpl *impl);
PImpl *p;
};
} // namespace radix
......
......@@ -21,12 +21,12 @@ NavigationModel::PImpl::~PImpl()
}
NavigationModel::NavigationModel(QObject* parent)
: QAbstractItemModel(parent)
, p(new PImpl(), deleter)
, p(new PImpl())
{
p->root = new NavigationItem();
}
void NavigationModel::deleter(PImpl* impl) { delete impl; }
NavigationModel::~NavigationModel() { delete p; }
QVariant NavigationModel::data(const QModelIndex& index, int role) const
{
......
......@@ -16,6 +16,7 @@ class RADIX_PUBLIC NavigationModel : public QAbstractItemModel
Q_OBJECT
public:
NavigationModel(QObject *parent = nullptr);
~NavigationModel();
QVariant data(const QModelIndex &index, int role) const override;
bool setData(const QModelIndex &index, const QVariant &value,
......@@ -37,8 +38,7 @@ class RADIX_PUBLIC NavigationModel : public QAbstractItemModel
private:
class PImpl;
std::unique_ptr<PImpl, void (*)(PImpl *)> p;
static void deleter(PImpl *impl);
PImpl *p;
};
} // namespace radix
......
......@@ -32,11 +32,14 @@ class RADIX_PUBLIC NavigationItemSortFilterProxyModel::PImpl
NavigationItemSortFilterProxyModel::NavigationItemSortFilterProxyModel(
QObject* parent)
: QSortFilterProxyModel(parent)
, p(new PImpl(), deleter)
, p(new PImpl())
{
}
void NavigationItemSortFilterProxyModel::deleter(PImpl* impl) { delete impl; }
NavigationItemSortFilterProxyModel::~NavigationItemSortFilterProxyModel()
{
delete p;
}
bool NavigationItemSortFilterProxyModel::accepts(const QModelIndex& index) const
{
......@@ -85,13 +88,13 @@ class RADIX_PUBLIC NavigationWidget::PImpl
NavigationWidget::NavigationWidget(QWidget* parent)
: QWidget(parent)
, p(new PImpl(), deleter)
, p(new PImpl())
{
initMembers();
initLayout();
}
void NavigationWidget::deleter(PImpl* impl) { delete impl; }
NavigationWidget::~NavigationWidget() { delete p; }
NavigationModel* NavigationWidget::navigationModel() { return p->model; }
......
......@@ -31,6 +31,7 @@ class RADIX_PUBLIC NavigationItemSortFilterProxyModel
public:
NavigationItemSortFilterProxyModel(QObject* parent = nullptr);
~NavigationItemSortFilterProxyModel();
public slots:
void clearCache();
......@@ -41,8 +42,7 @@ class RADIX_PUBLIC NavigationItemSortFilterProxyModel
private:
bool accepts(const QModelIndex& index) const;
class PImpl;
std::unique_ptr<PImpl, void (*)(PImpl*)> p;
static void deleter(PImpl* impl);
PImpl* p;
};
class RADIX_PUBLIC NavigationWidget : public QWidget
......@@ -51,6 +51,7 @@ class RADIX_PUBLIC NavigationWidget : public QWidget
public:
NavigationWidget(QWidget* parent = nullptr);
~NavigationWidget();
void collapse(QStandardItem* item);
......@@ -79,8 +80,7 @@ class RADIX_PUBLIC NavigationWidget : public QWidget
void initMembers();
class PImpl;
std::unique_ptr<PImpl, void (*)(PImpl*)> p;
static void deleter(PImpl* impl);
PImpl* p;
};
} // namespace radix
......
......@@ -29,11 +29,11 @@ TableView::PImpl::PImpl()
TableView::TableView(QWidget *parent)
: QTableView(parent)
, p(new PImpl(), deleter)
, p(new PImpl)
{
}
void TableView::deleter(PImpl *impl) { delete impl; }
TableView::~TableView() { delete p; }
char TableView::separator() const { return p->separator; }
......
......@@ -20,11 +20,12 @@ class RADIX_PUBLIC TableView : public QTableView
Q_OBJECT
class PImpl;
std::unique_ptr<PImpl, void (*)(PImpl *)> p;
PImpl *p;
static void deleter(PImpl *impl);
public:
TableView(QWidget *parent = nullptr);
~TableView();
char separator() const;
void setSeparator(char value);
......
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