From 6e419a961e0b17227f4341880055c5690410607c Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Sun, 2 Sep 2018 13:23:36 -0400 Subject: use boost::shared_ptr<> to manage Button/Pad lifetimes in Push2 code --- libs/surfaces/push2/buttons.cc | 31 +++++++++++++++-------------- libs/surfaces/push2/mix.cc | 11 +++++++---- libs/surfaces/push2/mix.h | 2 +- libs/surfaces/push2/push2.cc | 42 ++++++++++++++++++++-------------------- libs/surfaces/push2/push2.h | 12 ++++++------ libs/surfaces/push2/scale.cc | 6 +++--- libs/surfaces/push2/scale.h | 2 +- libs/surfaces/push2/track_mix.cc | 10 +++++----- 8 files changed, 60 insertions(+), 56 deletions(-) diff --git a/libs/surfaces/push2/buttons.cc b/libs/surfaces/push2/buttons.cc index 05f68774ec..03d2272af7 100644 --- a/libs/surfaces/push2/buttons.cc +++ b/libs/surfaces/push2/buttons.cc @@ -37,10 +37,10 @@ Push2::build_maps () { /* Pads */ - Pad* pad; + boost::shared_ptr pad; #define MAKE_PAD(x,y,nn) \ - pad = new Pad ((x), (y), (nn)); \ + pad.reset (new Pad ((x), (y), (nn))); \ nn_pad_map.insert (std::make_pair (pad->extra(), pad)); MAKE_PAD (0, 0, 92); @@ -110,18 +110,18 @@ Push2::build_maps () /* Now color buttons */ - Button *button; + boost::shared_ptr