diff options
author | Neil <nyamatongwe@gmail.com> | 2017-04-22 09:16:08 +1000 |
---|---|---|
committer | Neil <nyamatongwe@gmail.com> | 2017-04-22 09:16:08 +1000 |
commit | b201e09daf251a0e3e5576b79643f6c4f841a4a9 (patch) | |
tree | bc7d0caf7e5a4d0635b7ee7ba593f4ee830a6072 /src/LineMarker.h | |
parent | 0801e0084a5cf87f424235d5947f5158474d5da4 (diff) | |
download | scintilla-mirror-b201e09daf251a0e3e5576b79643f6c4f841a4a9.tar.gz |
Using unique_ptr to simplify ownership of images, case folder, and list box.
Diffstat (limited to 'src/LineMarker.h')
-rw-r--r-- | src/LineMarker.h | 28 |
1 files changed, 11 insertions, 17 deletions
diff --git a/src/LineMarker.h b/src/LineMarker.h index fde11da0d..2006fe8fb 100644 --- a/src/LineMarker.h +++ b/src/LineMarker.h @@ -25,8 +25,8 @@ public: ColourDesired back; ColourDesired backSelected; int alpha; - XPM *pxpm; - RGBAImage *image; + std::unique_ptr<XPM> pxpm; + std::unique_ptr<RGBAImage> image; /** Some platforms, notably PLAT_CURSES, do not support Scintilla's native * Draw function for drawing line markers. Allow those platforms to override * it instead of creating a new method(s) in the Surface class that existing @@ -38,38 +38,32 @@ public: back = ColourDesired(0xff,0xff,0xff); backSelected = ColourDesired(0xff,0x00,0x00); alpha = SC_ALPHA_NOALPHA; - pxpm = NULL; - image = NULL; - customDraw = NULL; + customDraw = nullptr; } LineMarker(const LineMarker &) { - // Defined to avoid pxpm being blindly copied, not as a complete copy constructor + // Defined to avoid pxpm and image being blindly copied, not as a complete copy constructor. markType = SC_MARK_CIRCLE; fore = ColourDesired(0,0,0); back = ColourDesired(0xff,0xff,0xff); backSelected = ColourDesired(0xff,0x00,0x00); alpha = SC_ALPHA_NOALPHA; - pxpm = NULL; - image = NULL; - customDraw = NULL; + pxpm.reset(); + image.reset(); + customDraw = nullptr; } ~LineMarker() { - delete pxpm; - delete image; } LineMarker &operator=(const LineMarker &other) { - // Defined to avoid pxpm being blindly copied, not as a complete assignment operator + // Defined to avoid pxpm and image being blindly copied, not as a complete assignment operator. if (this != &other) { markType = SC_MARK_CIRCLE; fore = ColourDesired(0,0,0); back = ColourDesired(0xff,0xff,0xff); backSelected = ColourDesired(0xff,0x00,0x00); alpha = SC_ALPHA_NOALPHA; - delete pxpm; - pxpm = NULL; - delete image; - image = NULL; - customDraw = NULL; + pxpm.reset(); + image.reset(); + customDraw = nullptr; } return *this; } |