VirtualBox

Changeset 57642 in vbox for trunk/src/VBox/Main/src-server


Ignore:
Timestamp:
Sep 7, 2015 1:05:50 PM (9 years ago)
Author:
vboxsync
Message:

Main/linux: one more check if DBus is not available (should fix a crash with older DBus libs)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-server/linux/HostPowerLinux.cpp

    r56845 r57642  
    2323#include <iprt/time.h>
    2424
    25 static bool checkDBusError(DBusError *pError, DBusConnection *pConnection)
     25static bool checkDBusError(DBusError *pError, DBusConnection **pConnection)
    2626{
    2727    if (dbus_error_is_set(pError))
     
    2929        LogRel(("HostPowerServiceLinux: DBus connection Error (%s)\n", pError->message));
    3030        dbus_error_free(pError);
    31         /* Close the socket or whatever underlying the connection. */
    32         dbus_connection_close(pConnection);
    33         /* Free in-process resources used for the now-closed connection. */
    34         dbus_connection_unref(pConnection);
     31        if (*pConnection)
     32        {
     33            /* Close the socket or whatever underlying the connection. */
     34            dbus_connection_close(*pConnection);
     35            /* Free in-process resources used for the now-closed connection. */
     36            dbus_connection_unref(*pConnection);
     37            *pConnection = NULL;
     38        }
    3539        return true;
    3640    }
     
    5963     * running as the user anyway" (see session.conf.in in the DBus sources). */
    6064    mpConnection = dbus_bus_get_private(DBUS_BUS_SYSTEM, &error);
    61     if (checkDBusError(&error, mpConnection))
     65    if (checkDBusError(&error, &mpConnection))
    6266        return;
    6367    /* We do not want to exit(1) if the connection is broken. */
     
    6973    dbus_bus_add_match(mpConnection, "type='signal',interface='org.freedesktop.UPower'", &error);
    7074    dbus_connection_flush(mpConnection);
    71     if (checkDBusError(&error, mpConnection))
     75    if (checkDBusError(&error, &mpConnection))
    7276        return;
    7377    /* Create the new worker thread. */
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