[vlc-commits] skins2: window_manager: use std::unique_ptr
Alexandre Janniaux
git at videolan.org
Tue Apr 20 12:14:35 UTC 2021
vlc | branch: master | Alexandre Janniaux <ajanni at videolabs.io> | Sun Apr 4 16:34:22 2021 +0200| [5dcd99509e6b539f326dba301e2713638da5d7b3] | committer: Alexandre Janniaux
skins2: window_manager: use std::unique_ptr
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=5dcd99509e6b539f326dba301e2713638da5d7b3
---
modules/gui/skins2/src/window_manager.cpp | 11 +++--------
modules/gui/skins2/src/window_manager.hpp | 3 ++-
2 files changed, 5 insertions(+), 9 deletions(-)
diff --git a/modules/gui/skins2/src/window_manager.cpp b/modules/gui/skins2/src/window_manager.cpp
index 2d3791509d..10ee635af1 100644
--- a/modules/gui/skins2/src/window_manager.cpp
+++ b/modules/gui/skins2/src/window_manager.cpp
@@ -33,7 +33,7 @@
WindowManager::WindowManager( intf_thread_t *pIntf ):
SkinObject( pIntf ), m_magnet( 0 ), m_alpha( 255 ), m_moveAlpha( 255 ),
m_opacityEnabled( false ), m_opacity( 255 ), m_direction( kNone ),
- m_maximizeRect(0, 0, 50, 50), m_pTooltip( NULL ), m_pPopup( NULL )
+ m_maximizeRect(0, 0, 50, 50), m_pPopup( NULL )
{
// Create and register a variable for the "on top" status
VarManager *pVarManager = VarManager::instance( getIntf() );
@@ -47,12 +47,7 @@ WindowManager::WindowManager( intf_thread_t *pIntf ):
m_opacity = 255 * var_InheritFloat( getIntf(), "qt-opacity" );
}
-
-WindowManager::~WindowManager()
-{
- delete m_pTooltip;
-}
-
+WindowManager::~WindowManager() = default;
void WindowManager::registerWindow( TopWindow &rWindow )
{
@@ -597,7 +592,7 @@ void WindowManager::createTooltip( const GenericFont &rTipFont )
// Create the tooltip window
if( !m_pTooltip )
{
- m_pTooltip = new Tooltip( getIntf(), rTipFont, 500 );
+ m_pTooltip = std::make_unique<Tooltip>( getIntf(), rTipFont, 500 );
}
else
{
diff --git a/modules/gui/skins2/src/window_manager.hpp b/modules/gui/skins2/src/window_manager.hpp
index 47cf875d83..6f6358e194 100644
--- a/modules/gui/skins2/src/window_manager.hpp
+++ b/modules/gui/skins2/src/window_manager.hpp
@@ -31,6 +31,7 @@
#include <map>
#include <set>
#include <utility>
+#include <memory>
class GenericFont;
@@ -219,7 +220,7 @@ private:
/// Rect of the last maximized window
SkinsRect m_maximizeRect;
/// Tooltip
- Tooltip *m_pTooltip;
+ std::unique_ptr<Tooltip> m_pTooltip;
/// Active popup, if any
Popup *m_pPopup;
More information about the vlc-commits
mailing list