Index: /trunk/src/VBox/Main/src-server/linux/HostPowerLinux.cpp
===================================================================
--- /trunk/src/VBox/Main/src-server/linux/HostPowerLinux.cpp	(revision 57652)
+++ /trunk/src/VBox/Main/src-server/linux/HostPowerLinux.cpp	(revision 57653)
@@ -85,4 +85,7 @@
 HostPowerServiceLinux::~HostPowerServiceLinux()
 {
+    int rc;
+    RTMSINTERVAL cMillies = 5000;
+
     /* Closing the connection should cause the event loop to exit. */
     LogFunc((": Stopping thread\n"));
@@ -90,5 +93,7 @@
         dbus_connection_close(mpConnection);
 
-    RTThreadWait(mThread, 5000, NULL);
+    rc = RTThreadWait(mThread, cMillies, NULL);
+    if (rc != VINF_SUCCESS)
+        LogRelThisFunc(("RTThreadWait() for %u ms failed with %Rrc\n", cMillies, rc));
     mThread = NIL_RTTHREAD;
 }
@@ -99,7 +104,8 @@
     NOREF(hThreadSelf);
     HostPowerServiceLinux *pPowerObj = static_cast<HostPowerServiceLinux *>(pInstance);
+    DBusConnection *pConnection = pPowerObj->mpConnection;
 
     Log(("HostPowerServiceLinux: Thread started\n"));
-    while (dbus_connection_read_write(pPowerObj->mpConnection, -1))
+    while (dbus_connection_read_write(pConnection, -1))
     {
         DBusMessage *pMessage = NULL;
@@ -110,5 +116,5 @@
             dbus_bool_t fSuspend;
 
-            pMessage = dbus_connection_pop_message(pPowerObj->mpConnection);
+            pMessage = dbus_connection_pop_message(pConnection);
             if (pMessage == NULL)
                 break;
@@ -140,8 +146,7 @@
     }
     /* Close the socket or whatever underlying the connection. */
-    dbus_connection_close(pPowerObj->mpConnection);
+    dbus_connection_close(pConnection);
     /* Free in-process resources used for the now-closed connection. */
-    dbus_connection_unref(pPowerObj->mpConnection);
-    pPowerObj->mpConnection = NULL;
+    dbus_connection_unref(pConnection);
     Log(("HostPowerServiceLinux: Exiting thread\n"));
     return VINF_SUCCESS;
