From 9a2310ae98d78763b92c8f25c893e2e721b7de91 Mon Sep 17 00:00:00 2001 From: Vojtech Bubnik Date: Mon, 18 Jan 2021 09:33:19 +0100 Subject: [PATCH] Fix of [prusa3d/PrusaSlicer] Remove unnecessary null pointer checks (#5813) Don't use if (ptr) delete ptr; call delete ptr; directly, it contains the test for null ptr. --- src/slic3r/GUI/ExtraRenderers.cpp | 3 +-- src/slic3r/GUI/GUI_Preview.cpp | 7 ++----- src/slic3r/GUI/Plater.cpp | 15 ++++----------- 3 files changed, 7 insertions(+), 18 deletions(-) diff --git a/src/slic3r/GUI/ExtraRenderers.cpp b/src/slic3r/GUI/ExtraRenderers.cpp index 27e2c1224..584896dd5 100644 --- a/src/slic3r/GUI/ExtraRenderers.cpp +++ b/src/slic3r/GUI/ExtraRenderers.cpp @@ -49,8 +49,7 @@ BitmapTextRenderer::~BitmapTextRenderer() { #ifdef SUPPORTS_MARKUP #ifdef wxHAS_GENERIC_DATAVIEWCTRL - if (m_markupText) - delete m_markupText; + delete m_markupText; #endif //wxHAS_GENERIC_DATAVIEWCTRL #endif // SUPPORTS_MARKUP } diff --git a/src/slic3r/GUI/GUI_Preview.cpp b/src/slic3r/GUI/GUI_Preview.cpp index bca27fa21..36c1960d3 100644 --- a/src/slic3r/GUI/GUI_Preview.cpp +++ b/src/slic3r/GUI/GUI_Preview.cpp @@ -36,11 +36,8 @@ View3D::View3D(wxWindow* parent, Model* model, DynamicPrintConfig* config, Backg View3D::~View3D() { - if (m_canvas != nullptr) - delete m_canvas; - - if (m_canvas_widget != nullptr) - delete m_canvas_widget; + delete m_canvas; + delete m_canvas_widget; } bool View3D::init(wxWindow* parent, Model* model, DynamicPrintConfig* config, BackgroundSlicingProcess* process) diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index 80826eab9..4d6b1178f 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -595,17 +595,10 @@ struct Sidebar::priv Sidebar::priv::~priv() { - if (object_manipulation != nullptr) - delete object_manipulation; - - if (object_settings != nullptr) - delete object_settings; - - if (frequently_changed_parameters != nullptr) - delete frequently_changed_parameters; - - if (object_layers != nullptr) - delete object_layers; + delete object_manipulation; + delete object_settings; + delete frequently_changed_parameters; + delete object_layers; } void Sidebar::priv::show_preset_comboboxes()