[Libreoffice-commits] core.git: vcl/inc vcl/source

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Wed Jan 27 06:39:13 UTC 2021


 vcl/inc/window.h             |    2 +-
 vcl/source/window/window.cxx |    7 +++----
 2 files changed, 4 insertions(+), 5 deletions(-)

New commits:
commit ed6765d3181fa1a97fe5d7766b748a7976b6f29a
Author:     Noel Grandin <noelgrandin at gmail.com>
AuthorDate: Tue Jan 26 20:58:22 2021 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed Jan 27 07:38:32 2021 +0100

    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 at collabora.co.uk>

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();
 }
 
 


More information about the Libreoffice-commits mailing list