VirtualBox

Changeset 21166 in vbox for trunk


Ignore:
Timestamp:
Jul 2, 2009 2:09:34 PM (16 years ago)
Author:
vboxsync
Message:

VBoxServiceVMInfo.cpp: Don't crash in the termination code if init fails.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/common/VBoxService/VBoxServiceVMInfo.cpp

    r19637 r21166  
    110110
    111111    int rc = RTSemEventMultiCreate(&g_VMInfoEvent);
    112     AssertRC(rc);
     112    AssertRCReturn(rc, rc);
    113113
    114114#ifdef RT_OS_WINDOWS
     
    123123
    124124    rc = VbglR3GuestPropConnect(&g_VMInfoGuestPropSvcClientID);
    125     if (!RT_SUCCESS(rc))
     125    if (RT_SUCCESS(rc))
     126        VBoxServiceVerbose(3, "Property Service Client ID: %#x\n", g_VMInfoGuestPropSvcClientID);
     127    else
    126128    {
    127129        VBoxServiceError("Failed to connect to the guest property service! Error: %Rrc\n", rc);
    128     }
    129     else
    130     {
    131         VBoxServiceVerbose(3, "Property Service Client ID: %ld\n", g_VMInfoGuestPropSvcClientID);
     130        RTSemEventMultiDestroy(g_VMInfoEvent);
     131        g_VMInfoEvent = NIL_RTSEMEVENTMULTI;
    132132    }
    133133
     
    437437    int rc;
    438438
    439     /** @todo temporary solution: Zap all values which are not valid
    440      *        anymore when VM goes down (reboot/shutdown ). Needs to
    441      *        be replaced with "temporary properties" later. */
    442     rc = VboxServiceWriteProp(g_VMInfoGuestPropSvcClientID, "GuestInfo/OS/LoggedInUsersList", NULL);
    443     rc = VboxServiceWritePropInt(g_VMInfoGuestPropSvcClientID, "GuestInfo/OS/LoggedInUsers", 0);
    444     if (g_VMInfoLoggedInUsers > 0)
    445         VboxServiceWriteProp(g_VMInfoGuestPropSvcClientID, "GuestInfo/OS/NoLoggedInUsers", "true");
    446 
    447     const char *apszPat[1] = { "/VirtualBox/GuestInfo/Net/*" };
    448     rc = VbglR3GuestPropDelSet(g_VMInfoGuestPropSvcClientID, &apszPat[0], RT_ELEMENTS(apszPat));
    449     rc = VboxServiceWritePropInt(g_VMInfoGuestPropSvcClientID, "GuestInfo/Net/Count", 0);
    450 
    451     /* Disconnect from guest properties service. */
    452     rc = VbglR3GuestPropDisconnect(g_VMInfoGuestPropSvcClientID);
    453     if (RT_FAILURE(rc))
    454         VBoxServiceError("Failed to disconnect from guest property service! Error: %Rrc\n", rc);
    455 
    456439    if (g_VMInfoEvent != NIL_RTSEMEVENTMULTI)
    457440    {
     441        /** @todo temporary solution: Zap all values which are not valid
     442         *        anymore when VM goes down (reboot/shutdown ). Needs to
     443         *        be replaced with "temporary properties" later.
     444         *
     445         *  @todo r=bird: This code isn't called on non-Windows systems. We need
     446         *        a more formal way of shutting down the service for that to work.
     447         */
     448        rc = VboxServiceWriteProp(g_VMInfoGuestPropSvcClientID, "GuestInfo/OS/LoggedInUsersList", NULL);
     449        rc = VboxServiceWritePropInt(g_VMInfoGuestPropSvcClientID, "GuestInfo/OS/LoggedInUsers", 0);
     450        if (g_VMInfoLoggedInUsers > 0)
     451            VboxServiceWriteProp(g_VMInfoGuestPropSvcClientID, "GuestInfo/OS/NoLoggedInUsers", "true");
     452
     453        const char *apszPat[1] = { "/VirtualBox/GuestInfo/Net/*" };
     454        rc = VbglR3GuestPropDelSet(g_VMInfoGuestPropSvcClientID, &apszPat[0], RT_ELEMENTS(apszPat));
     455        rc = VboxServiceWritePropInt(g_VMInfoGuestPropSvcClientID, "GuestInfo/Net/Count", 0);
     456
     457        /* Disconnect from guest properties service. */
     458        rc = VbglR3GuestPropDisconnect(g_VMInfoGuestPropSvcClientID);
     459        if (RT_FAILURE(rc))
     460            VBoxServiceError("Failed to disconnect from guest property service! Error: %Rrc\n", rc);
     461        g_VMInfoGuestPropSvcClientID = 0;
     462
     463
    458464        RTSemEventMultiDestroy(g_VMInfoEvent);
    459465        g_VMInfoEvent = NIL_RTSEMEVENTMULTI;
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette