56 lines
1.7 KiB
Diff
56 lines
1.7 KiB
Diff
|
From 0984079e08c252b0baf5ccab50f8196edd714904 Mon Sep 17 00:00:00 2001
|
||
|
From: Frediano Ziglio <fziglio@redhat.com>
|
||
|
Date: Fri, 29 Jun 2018 19:33:25 +0100
|
||
|
Subject: [PATCH 27/43] Use std::unique_ptr for _desktop_layout
|
||
|
|
||
|
Make automatic the release of this pointer.
|
||
|
Also avoids having a leak if VDAgent::run is called twice.
|
||
|
|
||
|
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
|
||
|
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
|
||
|
---
|
||
|
vdagent/vdagent.cpp | 6 ++----
|
||
|
1 file changed, 2 insertions(+), 4 deletions(-)
|
||
|
|
||
|
diff --git a/vdagent/vdagent.cpp b/vdagent/vdagent.cpp
|
||
|
index 7b3720d..1a68e0c 100644
|
||
|
--- a/vdagent/vdagent.cpp
|
||
|
+++ b/vdagent/vdagent.cpp
|
||
|
@@ -142,7 +142,7 @@ private:
|
||
|
bool _running;
|
||
|
bool _session_is_locked;
|
||
|
bool _desktop_switch;
|
||
|
- DesktopLayout* _desktop_layout;
|
||
|
+ std::unique_ptr<DesktopLayout> _desktop_layout;
|
||
|
bool _updating_display_config;
|
||
|
DisplaySetting _display_setting;
|
||
|
FileXfer _file_xfer;
|
||
|
@@ -198,7 +198,6 @@ VDAgent::VDAgent()
|
||
|
, _running (false)
|
||
|
, _session_is_locked (false)
|
||
|
, _desktop_switch (false)
|
||
|
- , _desktop_layout (NULL)
|
||
|
, _display_setting (VD_AGENT_REGISTRY_KEY)
|
||
|
, _vio_serial (NULL)
|
||
|
, _read_pos (0)
|
||
|
@@ -301,7 +300,7 @@ bool VDAgent::run()
|
||
|
cleanup();
|
||
|
return false;
|
||
|
}
|
||
|
- _desktop_layout = new DesktopLayout();
|
||
|
+ _desktop_layout.reset(new DesktopLayout());
|
||
|
if (_desktop_layout->get_display_count() == 0) {
|
||
|
vd_printf("No QXL devices!");
|
||
|
}
|
||
|
@@ -343,7 +342,6 @@ void VDAgent::cleanup()
|
||
|
CloseHandle(_stop_event);
|
||
|
CloseHandle(_control_event);
|
||
|
CloseHandle(_vio_serial);
|
||
|
- delete _desktop_layout;
|
||
|
}
|
||
|
|
||
|
void VDAgent::set_control_event(control_command_t control_command)
|
||
|
--
|
||
|
2.17.1
|
||
|
|