[Libreoffice-commits] core.git: vcl/inc vcl/source
Noel Grandin
noel.grandin at collabora.co.uk
Thu Sep 14 08:12:36 UTC 2017
vcl/inc/window.h | 3 ++-
vcl/source/window/window.cxx | 2 --
vcl/source/window/window2.cxx | 7 +++----
3 files changed, 5 insertions(+), 7 deletions(-)
New commits:
commit d36ccd2a7111b35276c21ed19750921fdfbfdacc
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date: Thu Sep 14 09:26:46 2017 +0200
use unique_ptr for mpControlFont
Change-Id: I71eed3254cf073b754c1a634315e6e739a816606
Reviewed-on: https://gerrit.libreoffice.org/42264
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/vcl/inc/window.h b/vcl/inc/window.h
index f7b25824397e..2238f59fe1fc 100644
--- a/vcl/inc/window.h
+++ b/vcl/inc/window.h
@@ -235,7 +235,8 @@ public:
Pointer maPointer;
Fraction maZoom;
OUString maText;
- vcl::Font* mpControlFont;
+ std::unique_ptr<vcl::Font>
+ mpControlFont;
Color maControlForeground;
Color maControlBackground;
sal_Int32 mnLeftBorder;
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index 4da4f2cbb0ca..2300c3b26b82 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -617,7 +617,6 @@ WindowImpl::WindowImpl( WindowType nType )
mnEventListenersIteratingCount = 0;
mnChildEventListenersIteratingCount = 0;
mpCursor = nullptr; // cursor
- mpControlFont = nullptr; // font properties
mpVCLXWindow = nullptr;
mpAccessibleInfos = nullptr;
maControlForeground = Color( COL_TRANSPARENT ); // no foreground set
@@ -743,7 +742,6 @@ WindowImpl::~WindowImpl()
{
delete mpChildClipRegion;
delete mpAccessibleInfos;
- delete mpControlFont;
}
ImplWinData::ImplWinData() :
diff --git a/vcl/source/window/window2.cxx b/vcl/source/window/window2.cxx
index 60d27fb5fa1e..4e38bcaba259 100644
--- a/vcl/source/window/window2.cxx
+++ b/vcl/source/window/window2.cxx
@@ -475,8 +475,7 @@ void Window::SetControlFont()
{
if (mpWindowImpl && mpWindowImpl->mpControlFont)
{
- delete mpWindowImpl->mpControlFont;
- mpWindowImpl->mpControlFont = nullptr;
+ mpWindowImpl->mpControlFont.reset();
CompatStateChanged(StateChangedType::ControlFont);
}
}
@@ -496,7 +495,7 @@ void Window::SetControlFont(const vcl::Font& rFont)
*mpWindowImpl->mpControlFont = rFont;
}
else
- mpWindowImpl->mpControlFont = new vcl::Font(rFont);
+ mpWindowImpl->mpControlFont.reset( new vcl::Font(rFont) );
CompatStateChanged(StateChangedType::ControlFont);
}
@@ -1110,7 +1109,7 @@ const InputContext& Window::GetInputContext() const
bool Window::IsControlFont() const
{
- return (mpWindowImpl->mpControlFont != nullptr);
+ return bool(mpWindowImpl->mpControlFont);
}
const Color& Window::GetControlForeground() const
More information about the Libreoffice-commits
mailing list