[Spice-commits] vdagent/vdagent.cpp
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Thu Jul 5 12:37:05 UTC 2018
vdagent/vdagent.cpp | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
New commits:
commit 0984079e08c252b0baf5ccab50f8196edd714904
Author: Frediano Ziglio <fziglio at redhat.com>
Date: Fri Jun 29 19:33:25 2018 +0100
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 at redhat.com>
Acked-by: Jonathon Jongsma <jjongsma at redhat.com>
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)
More information about the Spice-commits
mailing list