diff --git a/src/Network/Swift/dbusdispatcher.cpp b/src/Network/Swift/dbusdispatcher.cpp index b28df5497..8a00b9312 100644 --- a/src/Network/Swift/dbusdispatcher.cpp +++ b/src/Network/Swift/dbusdispatcher.cpp @@ -1,5 +1,5 @@ -// dbus-dispatcher.cpp -// +// dbus-dispatcher.cpp +// // Copyright (C) 2019 - swift Project Community / Contributors (http://swift-project.org/) // Adapted to Flightgear by Lars Toenning // @@ -21,6 +21,15 @@ #include "dbusconnection.h" #include +namespace { // anonymosu namespace + +template +std::unique_ptr our_make_unique(Args&&... args) { + return std::unique_ptr(new T(std::forward(args)...)); +} + +} // end of anonymous namespace + namespace FGSwiftBus { @@ -198,7 +207,7 @@ namespace FGSwiftBus if (dbus_watch_get_enabled(watch) == FALSE) { return true; } int fd = dbus_watch_get_unix_fd(watch); - m_watchers.emplace(fd, new WatchHandler(m_eventBase.get(), watch)); + m_watchers.emplace(fd, our_make_unique(m_eventBase.get(), watch)); return true; }