aboutsummaryrefslogtreecommitdiffhomepage
path: root/qt/ScintillaEditBase
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2021-03-18 19:39:42 +1100
committerNeil <nyamatongwe@gmail.com>2021-03-18 19:39:42 +1100
commit402e089842d5aa2bb3774a665e26c42dc91fa5b4 (patch)
tree58304e9b27215782eec1a5c38e0636b2a18bafef /qt/ScintillaEditBase
parent43c4b61bdd3669c2cc08d50f10401f0b04befcc9 (diff)
downloadscintilla-mirror-402e089842d5aa2bb3774a665e26c42dc91fa5b4.tar.gz
Use unique_ptr for Surface::Allocate to show transfer of ownership.
Diffstat (limited to 'qt/ScintillaEditBase')
-rw-r--r--qt/ScintillaEditBase/PlatQt.cpp4
-rw-r--r--qt/ScintillaEditBase/ScintillaQt.cpp5
2 files changed, 4 insertions, 5 deletions
diff --git a/qt/ScintillaEditBase/PlatQt.cpp b/qt/ScintillaEditBase/PlatQt.cpp
index d49d22f0f..9cbf591b9 100644
--- a/qt/ScintillaEditBase/PlatQt.cpp
+++ b/qt/ScintillaEditBase/PlatQt.cpp
@@ -611,9 +611,9 @@ QPainter *SurfaceImpl::GetPainter()
return painter;
}
-Surface *Surface::Allocate(int)
+std::unique_ptr<Surface> Surface::Allocate(int)
{
- return new SurfaceImpl;
+ return std::make_unique<SurfaceImpl>();
}
diff --git a/qt/ScintillaEditBase/ScintillaQt.cpp b/qt/ScintillaEditBase/ScintillaQt.cpp
index 859396aa2..707862416 100644
--- a/qt/ScintillaEditBase/ScintillaQt.cpp
+++ b/qt/ScintillaEditBase/ScintillaQt.cpp
@@ -668,12 +668,11 @@ public:
void paintEvent(QPaintEvent *) override
{
if (pct->inCallTipMode) {
- Surface *surfaceWindow = Surface::Allocate(0);
+ std::unique_ptr<Surface> surfaceWindow = Surface::Allocate(0);
surfaceWindow->Init(this);
surfaceWindow->SetUnicodeMode(SC_CP_UTF8 == pct->codePage);
surfaceWindow->SetDBCSMode(pct->codePage);
- pct->PaintCT(surfaceWindow);
- delete surfaceWindow;
+ pct->PaintCT(surfaceWindow.get());
}
}