[Spice-devel] [PATCH 2/5] Pass class pointer using control context

Frediano Ziglio fziglio at redhat.com
Fri Aug 12 11:02:06 UTC 2016


Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
 vdservice/vdservice.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/vdservice/vdservice.cpp b/vdservice/vdservice.cpp
index 12f7644..ef1ed9f 100644
--- a/vdservice/vdservice.cpp
+++ b/vdservice/vdservice.cpp
@@ -284,7 +284,7 @@ void VDService::handle_control_event()
 DWORD WINAPI VDService::control_handler(DWORD control, DWORD event_type, LPVOID event_data,
                                         LPVOID context)
 {
-    VDService* s = _singleton;
+    VDService* s = static_cast<VDService *>(context);
     DWORD ret = NO_ERROR;
 
     ASSERT(s);
@@ -352,7 +352,7 @@ VOID WINAPI VDService::main(DWORD argc, TCHAR* argv[])
     status->dwWaitHint = 0;
 #ifndef  DEBUG_VDSERVICE
     s->_status_handle = RegisterServiceCtrlHandlerEx(VD_SERVICE_NAME, &VDService::control_handler,
-                                                     NULL);
+                                                     s);
     if (!s->_status_handle) {
         vd_printf("RegisterServiceCtrlHandler failed\n");
         return;
-- 
2.7.4



More information about the Spice-devel mailing list