summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2021-01-26 20:58:22 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-01-27 07:38:32 +0100
commited6765d3181fa1a97fe5d7766b748a7976b6f29a (patch)
tree7cf8ae5cac992acb3c588ecc4c91534772f7d1f9
parentb2ebceeaf49aa45979486997e6358697b7045361 (diff)
use unique_ptr for mpWinData
Change-Id: I38a9cedc3041a78160536b40bd369df767101de5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109993 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--vcl/inc/window.h2
-rw-r--r--vcl/source/window/window.cxx7
2 files changed, 4 insertions, 5 deletions
diff --git a/vcl/inc/window.h b/vcl/inc/window.h
index a14852ca02c0..9c1ee12937d8 100644
--- a/vcl/inc/window.h
+++ b/vcl/inc/window.h
@@ -221,7 +221,7 @@ public:
WindowImpl( WindowType );
~WindowImpl();
- ImplWinData* mpWinData;
+ std::unique_ptr<ImplWinData> mpWinData;
ImplFrameData* mpFrameData;
SalFrame* mpFrame;
SalObject* mpSysObj;
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index 6b43b4793c43..e21cacd71c07 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -517,8 +517,7 @@ void Window::dispose()
}
}
- delete mpWindowImpl->mpWinData;
- mpWindowImpl->mpWinData = nullptr;
+ mpWindowImpl->mpWinData.reset();
// remove BorderWindow or Frame window data
mpWindowImpl->mpBorderWindow.disposeAndClear();
@@ -1214,11 +1213,11 @@ ImplWinData* Window::ImplGetWinData() const
{
static const char* pNoNWF = getenv( "SAL_NO_NWF" );
- const_cast<vcl::Window*>(this)->mpWindowImpl->mpWinData = new ImplWinData;
+ const_cast<vcl::Window*>(this)->mpWindowImpl->mpWinData.reset(new ImplWinData);
mpWindowImpl->mpWinData->mbEnableNativeWidget = !(pNoNWF && *pNoNWF); // true: try to draw this control with native theme API
}
- return mpWindowImpl->mpWinData;
+ return mpWindowImpl->mpWinData.get();
}