From 5fc3b06e8e05cc95cb4c11f600b85f8c95dd12a5 Mon Sep 17 00:00:00 2001 From: David Capello Date: Thu, 21 May 2015 10:39:09 -0300 Subject: [PATCH] Change ColorMap::m_remap to UniquePtr --- src/app/ui/color_bar.cpp | 7 ++----- src/app/ui/color_bar.h | 2 +- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/app/ui/color_bar.cpp b/src/app/ui/color_bar.cpp index 49c36bf51..e4a07a3de 100644 --- a/src/app/ui/color_bar.cpp +++ b/src/app/ui/color_bar.cpp @@ -109,7 +109,6 @@ ColorBar::ColorBar(int align) , m_bgColor(app::Color::fromRgb(0, 0, 0), IMAGE_RGB) , m_lock(false) , m_syncingWithPref(false) - , m_remap(nullptr) , m_lastDocument(nullptr) , m_ascending(true) { @@ -406,7 +405,7 @@ void ColorBar::onPaletteViewRemapColors(const Remap& remap, const Palette* newPa void ColorBar::applyRemap(const doc::Remap& remap, const doc::Palette* newPalette, const std::string& actionText) { if (!m_remap) { - m_remap = new doc::Remap(remap); + m_remap.reset(new doc::Remap(remap)); m_remapButton.setVisible(true); layout(); } @@ -681,9 +680,7 @@ void ColorBar::destroyRemap() if (!m_remap) return; - delete m_remap; - m_remap = nullptr; - + m_remap.reset(); m_remapButton.setVisible(false); layout(); } diff --git a/src/app/ui/color_bar.h b/src/app/ui/color_bar.h index 7b3cf68b5..7461bc272 100644 --- a/src/app/ui/color_bar.h +++ b/src/app/ui/color_bar.h @@ -117,7 +117,7 @@ namespace app { ColorButton m_bgColor; bool m_lock; bool m_syncingWithPref; - doc::Remap* m_remap; + base::UniquePtr m_remap; const doc::Document* m_lastDocument; bool m_ascending; ScopedConnection m_conn;