diff --git a/include/boo/IApplication.hpp b/include/boo/IApplication.hpp index 2693a1e..fc88800 100644 --- a/include/boo/IApplication.hpp +++ b/include/boo/IApplication.hpp @@ -56,7 +56,7 @@ public: }; -std::shared_ptr +std::unique_ptr ApplicationBootstrap(IApplication::EPlatformType platform, IApplicationCallback& cb, const std::string& uniqueName, @@ -66,7 +66,7 @@ ApplicationBootstrap(IApplication::EPlatformType platform, bool singleInstance=true); extern IApplication* APP; -static inline std::shared_ptr +static inline std::unique_ptr ApplicationBootstrap(IApplication::EPlatformType platform, IApplicationCallback& cb, const std::string& uniqueName, @@ -75,7 +75,7 @@ ApplicationBootstrap(IApplication::EPlatformType platform, bool singleInstance=true) { if (APP) - return std::shared_ptr(APP); + return std::unique_ptr(); std::vector args; for (int i=1 ; i ApplicationBootstrap(IApplication::EPlatformType platform, +std::unique_ptr ApplicationBootstrap(IApplication::EPlatformType platform, IApplicationCallback& cb, const std::string& uniqueName, const std::string& friendlyName, @@ -56,17 +56,16 @@ std::shared_ptr ApplicationBootstrap(IApplication::EPlatformType p const std::vector& args, bool singleInstance) { - if (!APP) - { - if (platform == IApplication::PLAT_WAYLAND) - APP = new ApplicationWayland(cb, uniqueName, friendlyName, pname, args, singleInstance); - else if (platform == IApplication::PLAT_XCB || - platform == IApplication::PLAT_AUTO) - APP = new ApplicationXCB(cb, uniqueName, friendlyName, pname, args, singleInstance); - else - return std::shared_ptr(); - } - return std::shared_ptr(APP); + if (APP) + return std::unique_ptr(); + if (platform == IApplication::PLAT_WAYLAND) + APP = new ApplicationWayland(cb, uniqueName, friendlyName, pname, args, singleInstance); + else if (platform == IApplication::PLAT_XCB || + platform == IApplication::PLAT_AUTO) + APP = new ApplicationXCB(cb, uniqueName, friendlyName, pname, args, singleInstance); + else + return std::unique_ptr(); + return std::unique_ptr(APP); } } diff --git a/test/main.cpp b/test/main.cpp index 22d4989..2d78790 100644 --- a/test/main.cpp +++ b/test/main.cpp @@ -137,7 +137,7 @@ struct TestApplicationCallback : IApplicationCallback int main(int argc, const char** argv) { boo::TestApplicationCallback appCb; - std::shared_ptr app = + std::unique_ptr app = ApplicationBootstrap(boo::IApplication::PLAT_AUTO, appCb, "rwk", "RWK", argc, argv); app->run();