mirror of
https://github.com/kidfromjupiter/nearby.git
synced 2026-09-16 15:36:12 -04:00
Add an ObjectManager instance at / for both system and session bus connections.
This commit is contained in:
@@ -13,8 +13,8 @@
|
||||
// limitations under the License.
|
||||
|
||||
#include <cassert>
|
||||
#include <memory>
|
||||
#include <cstdlib>
|
||||
#include <memory>
|
||||
|
||||
#include <sdbus-c++/IConnection.h>
|
||||
|
||||
@@ -27,9 +27,13 @@ static std::unique_ptr<sdbus::IConnection> global_system_bus_connection =
|
||||
nullptr;
|
||||
static std::unique_ptr<sdbus::IConnection> global_default_bus_connection =
|
||||
nullptr;
|
||||
static std::unique_ptr<RootObjectManager> system_root_object_manager = nullptr;
|
||||
static std::unique_ptr<RootObjectManager> default_root_object_manager = nullptr;
|
||||
static absl::once_flag bus_connection_init_;
|
||||
|
||||
static void disconnectBus() {
|
||||
system_root_object_manager = nullptr;
|
||||
default_root_object_manager = nullptr;
|
||||
global_system_bus_connection = nullptr;
|
||||
global_default_bus_connection = nullptr;
|
||||
}
|
||||
@@ -39,6 +43,11 @@ static void initBusConnections() {
|
||||
global_system_bus_connection->enterEventLoopAsync();
|
||||
global_default_bus_connection = sdbus::createDefaultBusConnection();
|
||||
global_default_bus_connection->enterEventLoopAsync();
|
||||
system_root_object_manager =
|
||||
std::make_unique<RootObjectManager>(*global_system_bus_connection);
|
||||
default_root_object_manager =
|
||||
std::make_unique<RootObjectManager>(*global_default_bus_connection);
|
||||
|
||||
atexit(disconnectBus);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user