From 778dccf9a7aa05e0c8df1481ea1d6048bb659667 Mon Sep 17 00:00:00 2001 From: Andy McFadden Date: Mon, 3 Mar 2014 17:09:54 -0800 Subject: Fix destructors Make destructors private -- only RefBase should be able to destroy instances of these. Change-Id: Iff52e226995fe5740a9dfc35af53dd6dd9d74501 --- cmds/screenrecord/FrameOutput.h | 8 +++++--- cmds/screenrecord/Overlay.h | 4 +++- 2 files changed, 8 insertions(+), 4 deletions(-) (limited to 'cmds') diff --git a/cmds/screenrecord/FrameOutput.h b/cmds/screenrecord/FrameOutput.h index b8e9e68..bb66e05 100644 --- a/cmds/screenrecord/FrameOutput.h +++ b/cmds/screenrecord/FrameOutput.h @@ -34,9 +34,6 @@ public: mExtTextureName(0), mPixelBuf(NULL) {} - virtual ~FrameOutput() { - delete[] mPixelBuf; - } // Create an "input surface", similar in purpose to a MediaCodec input // surface, that the virtual display can send buffers to. Also configures @@ -59,6 +56,11 @@ private: FrameOutput(const FrameOutput&); FrameOutput& operator=(const FrameOutput&); + // Destruction via RefBase. + virtual ~FrameOutput() { + delete[] mPixelBuf; + } + // (overrides GLConsumer::FrameAvailableListener method) virtual void onFrameAvailable(); diff --git a/cmds/screenrecord/Overlay.h b/cmds/screenrecord/Overlay.h index b8473b4..48e48e0 100644 --- a/cmds/screenrecord/Overlay.h +++ b/cmds/screenrecord/Overlay.h @@ -47,7 +47,6 @@ public: mLastFrameNumber(-1), mTotalDroppedFrames(0) {} - virtual ~Overlay() { assert(mState == UNINITIALIZED || mState == STOPPED); } // Creates a thread that performs the overlay. Pass in the surface that // output will be sent to. @@ -71,6 +70,9 @@ private: Overlay(const Overlay&); Overlay& operator=(const Overlay&); + // Destruction via RefBase. + virtual ~Overlay() { assert(mState == UNINITIALIZED || mState == STOPPED); } + // Draw the initial info screen. static void doDrawInfoPage(const EglWindow& window, const Program& texRender, TextRenderer& textRenderer); -- cgit v1.1