Index: /trunk/src/VBox/Additions/common/VBoxService/VBoxServicePropCache.cpp
===================================================================
--- /trunk/src/VBox/Additions/common/VBoxService/VBoxServicePropCache.cpp	(revision 36248)
+++ /trunk/src/VBox/Additions/common/VBoxService/VBoxServicePropCache.cpp	(revision 36249)
@@ -99,5 +99,5 @@
         if (RTStrAPrintfV(&pszValue, pszValueFormat, va) >= 0)
         {
-            if (fFlags & VBOXSERVICEPROPCACHEFLAG_TEMPORARY)
+            if (fFlags & VBOXSERVICEPROPCACHEFLAG_TRANSIENT)
             {
                 /*
@@ -118,5 +118,5 @@
             }
             else
-                rc = VbglR3GuestPropWriteValue(u32ClientId, pszName, pszValue);
+                rc = VbglR3GuestPropWriteValue(u32ClientId, pszName, pszValue /* No transient flags set */);
             RTStrFree(pszValue);
         }
@@ -383,11 +383,9 @@
             RTListNodeRemove(&pNode->NodeSucc);
 
-            /*
-             * When destroying the cache and we have a temporary value, remove the
-             * (eventually) set TRANSIENT_RESET flag from it so that it doesn't get deleted
-             * by the host side in order to put the actual reset value in it.
-             */
             if (pNode->fFlags & VBOXSERVICEPROPCACHEFLAG_TEMPORARY)
-                vboxServicePropCacheWritePropF(pCache->uClientID, pNode->pszName, 0 /* Flags, clear all */, pNode->pszValueReset);
+            {
+                rc = vboxServicePropCacheWritePropF(pCache->uClientID, pNode->pszName,
+                                                    pNode->fFlags, pNode->pszValueReset);
+            }
 
             AssertPtr(pNode->pszName);
Index: /trunk/src/VBox/Additions/common/VBoxService/VBoxServicePropCache.h
===================================================================
--- /trunk/src/VBox/Additions/common/VBoxService/VBoxServicePropCache.h	(revision 36248)
+++ /trunk/src/VBox/Additions/common/VBoxService/VBoxServicePropCache.h	(revision 36249)
@@ -24,14 +24,17 @@
 
 /** Indicates wheter a guest property is temporary and either should
- *  get deleted when
- *  - a) the property cache gets destroyed, or
- *  - b) the VM gets a hard reset / shutdown
- *  or gets a default "reset" value (if specified via VBoxServicePropCacheUpdateEntry)
- *  when the property cache gets properly destroyed.
+ *  - a) get a "reset" value assigned (via VBoxServicePropCacheUpdateEntry)
+ *       as soon as the property cache gets destroyed, or
+ *  - b) get deleted when no reset value is specified.
  */
-#define VBOXSERVICEPROPCACHEFLAG_TEMPORARY          RT_BIT(1)
+#define VBOXSERVICEPROPCACHEFLAG_TEMPORARY              RT_BIT(1)
 /** Indicates whether a property every time needs to be updated, regardless
  *  if its real value changed or not. */
-#define VBOXSERVICEPROPCACHEFLAG_ALWAYS_UPDATE      RT_BIT(2)
+#define VBOXSERVICEPROPCACHEFLAG_ALWAYS_UPDATE          RT_BIT(2)
+/** The guest property gets deleted when
+ *  - a) the property cache gets destroyed, or
+ *  - b) the VM gets reset / shutdown / destroyed.
+ */
+#define VBOXSERVICEPROPCACHEFLAG_TRANSIENT              RT_BIT(3)
 
 int VBoxServicePropCacheCreate(PVBOXSERVICEVEPROPCACHE pCache, uint32_t uClientId);
Index: /trunk/src/VBox/Additions/common/VBoxService/VBoxServiceVMInfo.cpp
===================================================================
--- /trunk/src/VBox/Additions/common/VBoxService/VBoxServiceVMInfo.cpp	(revision 36248)
+++ /trunk/src/VBox/Additions/common/VBoxService/VBoxServiceVMInfo.cpp	(revision 36249)
@@ -147,9 +147,9 @@
          */
         VBoxServicePropCacheUpdateEntry(&g_VMInfoPropCache, "/VirtualBox/GuestInfo/OS/LoggedInUsersList",
-                                        VBOXSERVICEPROPCACHEFLAG_TEMPORARY, NULL /* Delete on exit */);
+                                        VBOXSERVICEPROPCACHEFLAG_TEMPORARY | VBOXSERVICEPROPCACHEFLAG_TRANSIENT, NULL /* Delete on exit */);
         VBoxServicePropCacheUpdateEntry(&g_VMInfoPropCache, "/VirtualBox/GuestInfo/OS/LoggedInUsers",
-                                        VBOXSERVICEPROPCACHEFLAG_TEMPORARY, "0");
+                                        VBOXSERVICEPROPCACHEFLAG_TEMPORARY | VBOXSERVICEPROPCACHEFLAG_TRANSIENT, "0");
         VBoxServicePropCacheUpdateEntry(&g_VMInfoPropCache, "/VirtualBox/GuestInfo/OS/NoLoggedInUsers",
-                                        VBOXSERVICEPROPCACHEFLAG_TEMPORARY, "true");
+                                        VBOXSERVICEPROPCACHEFLAG_TEMPORARY | VBOXSERVICEPROPCACHEFLAG_TRANSIENT, "true");
         VBoxServicePropCacheUpdateEntry(&g_VMInfoPropCache, "/VirtualBox/GuestInfo/Net/Count",
                                         VBOXSERVICEPROPCACHEFLAG_TEMPORARY | VBOXSERVICEPROPCACHEFLAG_ALWAYS_UPDATE, NULL /* Delete on exit */);
Index: /trunk/src/VBox/Frontends/VBoxHeadless/VBoxHeadless.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VBoxHeadless/VBoxHeadless.cpp	(revision 36248)
+++ /trunk/src/VBox/Frontends/VBoxHeadless/VBoxHeadless.cpp	(revision 36249)
@@ -208,4 +208,6 @@
                     if (fProcessDisconnectOnGuestLogout)
                     {
+                        bool fDropConnection = false;
+
                         Bstr value;
                         gpcev->COMGETTER(Value)(value.asOutParam());
@@ -216,29 +218,39 @@
                             {
                                 mfNoLoggedInUsers = true;
-
-                                /* If there is a connection, drop it. */
-                                ComPtr<IVRDEServerInfo> info;
-                                hrc = gConsole->COMGETTER(VRDEServerInfo)(info.asOutParam());
-                                if (SUCCEEDED(hrc) && info)
-                                {
-                                    ULONG cClients = 0;
-                                    hrc = info->COMGETTER(NumberOfClients)(&cClients);
-                                    if (SUCCEEDED(hrc) && cClients > 0)
-                                    {
-                                        ComPtr <IVRDEServer> vrdeServer;
-                                        hrc = machine->COMGETTER(VRDEServer)(vrdeServer.asOutParam());
-                                        if (SUCCEEDED(hrc) && vrdeServer)
-                                        {
-                                            LogRel(("VRDE: the guest user has logged out, disconnecting remote clients.\n"));
-                                            vrdeServer->COMSETTER(Enabled)(FALSE);
-                                            vrdeServer->COMSETTER(Enabled)(TRUE);
-                                        }
-                                    }
-                                }
+                                fDropConnection = true;
                             }
+                        }
+                        /* Guest property got deleted due to hard reset,
+                         * so it has no value anymore. */
+                        else if (utf8Value.isEmpty())
+                        {
+                            fDropConnection = true;
                         }
                         else
                         {
                             mfNoLoggedInUsers = false;
+                        }
+
+                        if (fDropConnection)
+                        {
+                            /* If there is a connection, drop it. */
+                            ComPtr<IVRDEServerInfo> info;
+                            hrc = gConsole->COMGETTER(VRDEServerInfo)(info.asOutParam());
+                            if (SUCCEEDED(hrc) && info)
+                            {
+                                ULONG cClients = 0;
+                                hrc = info->COMGETTER(NumberOfClients)(&cClients);
+                                if (SUCCEEDED(hrc) && cClients > 0)
+                                {
+                                    ComPtr <IVRDEServer> vrdeServer;
+                                    hrc = machine->COMGETTER(VRDEServer)(vrdeServer.asOutParam());
+                                    if (SUCCEEDED(hrc) && vrdeServer)
+                                    {
+                                        LogRel(("VRDE: the guest user has logged out, disconnecting remote clients.\n"));
+                                        vrdeServer->COMSETTER(Enabled)(FALSE);
+                                        vrdeServer->COMSETTER(Enabled)(TRUE);
+                                    }
+                                }
+                            }
                         }
                     }
@@ -532,5 +544,5 @@
 #endif /* VBOX_FFMPEG defined */
 
-#ifdef RT_OS_WINDOWS 
+#ifdef RT_OS_WINDOWS
 // Required for ATL
 static CComModule _Module;
@@ -1326,5 +1338,5 @@
     pVirtualBoxClient.setNull();
     machine.setNull();
-  
+
     com::Shutdown();
 
