fix: crash using powerMonitor
before ready event (#40888)
* fix: crash using powerMonitor before ready event * refactor: continue using DBusBluezManagerWrapperLinux
This commit is contained in:
parent
7b4d490bfe
commit
c184b93fc5
2 changed files with 8 additions and 1 deletions
|
@ -11,7 +11,9 @@
|
|||
#include "base/files/file_path.h"
|
||||
#include "base/functional/bind.h"
|
||||
#include "base/logging.h"
|
||||
#include "device/bluetooth/dbus/bluez_dbus_manager.h"
|
||||
#include "device/bluetooth/dbus/bluez_dbus_thread_manager.h"
|
||||
#include "device/bluetooth/dbus/dbus_bluez_manager_wrapper_linux.h"
|
||||
|
||||
namespace {
|
||||
|
||||
|
@ -34,6 +36,9 @@ PowerObserverLinux::PowerObserverLinux(
|
|||
base::PowerSuspendObserver* suspend_observer)
|
||||
: suspend_observer_(suspend_observer),
|
||||
lock_owner_name_(GetExecutableBaseName()) {
|
||||
if (!bluez::BluezDBusManager::IsInitialized())
|
||||
bluez::DBusBluezManagerWrapperLinux::Initialize();
|
||||
|
||||
auto* bus = bluez::BluezDBusThreadManager::Get()->GetSystemBus();
|
||||
if (!bus) {
|
||||
LOG(WARNING) << "Failed to get system bus connection";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue