diff options
author | Neil <nyamatongwe@gmail.com> | 2017-05-02 10:06:46 +1000 |
---|---|---|
committer | Neil <nyamatongwe@gmail.com> | 2017-05-02 10:06:46 +1000 |
commit | ffeb34c29ffd27e1a1a67cb26ceec8fc1253a410 (patch) | |
tree | 59d17870a0bea7b8a058100fdd98666227e7684e /src/MarginView.cxx | |
parent | 782ada0bab34bb56c4023c070e6eb355ca32cdf2 (diff) | |
download | scintilla-mirror-ffeb34c29ffd27e1a1a67cb26ceec8fc1253a410.tar.gz |
Use unique_ptr for drawing surfaces and don't check for allocation failure
as that throws an exception.
Also use unique_ptr for tab stop positions.
Diffstat (limited to 'src/MarginView.cxx')
-rw-r--r-- | src/MarginView.cxx | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/src/MarginView.cxx b/src/MarginView.cxx index 27bf1e10d..e371a4891 100644 --- a/src/MarginView.cxx +++ b/src/MarginView.cxx @@ -102,21 +102,15 @@ void DrawWrapMarker(Surface *surface, PRectangle rcPlace, } MarginView::MarginView() { - pixmapSelMargin = 0; - pixmapSelPattern = 0; - pixmapSelPatternOffset1 = 0; wrapMarkerPaddingRight = 3; customDrawWrapMarker = NULL; } void MarginView::DropGraphics(bool freeObjects) { if (freeObjects) { - delete pixmapSelMargin; - pixmapSelMargin = 0; - delete pixmapSelPattern; - pixmapSelPattern = 0; - delete pixmapSelPatternOffset1; - pixmapSelPatternOffset1 = 0; + pixmapSelMargin.reset(); + pixmapSelPattern.reset(); + pixmapSelPatternOffset1.reset(); } else { if (pixmapSelMargin) pixmapSelMargin->Release(); @@ -129,11 +123,11 @@ void MarginView::DropGraphics(bool freeObjects) { void MarginView::AllocateGraphics(const ViewStyle &vsDraw) { if (!pixmapSelMargin) - pixmapSelMargin = Surface::Allocate(vsDraw.technology); + pixmapSelMargin.reset(Surface::Allocate(vsDraw.technology)); if (!pixmapSelPattern) - pixmapSelPattern = Surface::Allocate(vsDraw.technology); + pixmapSelPattern.reset(Surface::Allocate(vsDraw.technology)); if (!pixmapSelPatternOffset1) - pixmapSelPatternOffset1 = Surface::Allocate(vsDraw.technology); + pixmapSelPatternOffset1.reset(Surface::Allocate(vsDraw.technology)); } void MarginView::RefreshPixMaps(Surface *surfaceWindow, WindowID wid, const ViewStyle &vsDraw) { |