On Mon, 2018-07-02 at 08:43 +0100, Frediano Ziglio wrote: > Handle _control_event and _stop_event destruction in destructor. > Still allows to call VDAgent::run multiple time if needed. Remove "Still" Acked-by: Jonathon Jongsma <jjongsma@xxxxxxxxxx> > > Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx> > --- > vdagent/vdagent.cpp | 13 +++++++++---- > 1 file changed, 9 insertions(+), 4 deletions(-) > > diff --git a/vdagent/vdagent.cpp b/vdagent/vdagent.cpp > index 0672516..def3508 100644 > --- a/vdagent/vdagent.cpp > +++ b/vdagent/vdagent.cpp > @@ -222,6 +222,8 @@ VDAgent::VDAgent() > > VDAgent::~VDAgent() > { > + CloseHandle(_stop_event); > + CloseHandle(_control_event); > delete _log; > } > > @@ -283,13 +285,18 @@ bool VDAgent::run() > return false; > } > } > - _control_event = CreateEvent(NULL, FALSE, FALSE, NULL); > + if (!_control_event) > + _control_event = CreateEvent(NULL, FALSE, FALSE, NULL); > if (!_control_event) { > vd_printf("CreateEvent() failed: %lu", GetLastError()); > cleanup(); > return false; > } > - _stop_event = OpenEvent(SYNCHRONIZE, FALSE, > VD_AGENT_STOP_EVENT); > + ResetEvent(_control_event); > + > + if (!_stop_event) > + _stop_event = OpenEvent(SYNCHRONIZE, FALSE, > VD_AGENT_STOP_EVENT); > + > memset(&wcls, 0, sizeof(wcls)); > wcls.lpfnWndProc = &VDAgent::wnd_proc; > wcls.lpszClassName = VD_AGENT_WINCLASS_NAME; > @@ -336,8 +343,6 @@ bool VDAgent::run() > > void VDAgent::cleanup() > { > - CloseHandle(_stop_event); > - CloseHandle(_control_event); > CloseHandle(_vio_serial); > } > _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel