diff --git a/include/TGUI/Texture.hpp b/include/TGUI/Texture.hpp index 9d5a00d3..3f4191b4 100644 --- a/include/TGUI/Texture.hpp +++ b/include/TGUI/Texture.hpp @@ -41,7 +41,7 @@ namespace tgui public: using CallbackFunc = std::function)>; - using ImageLoaderFunc = std::function(const sf::String&)>; + using ImageLoaderFunc = std::function(const sf::String&)>; using TextureLoaderFunc = std::function(Texture&, const sf::String&, const sf::IntRect&)>; diff --git a/include/TGUI/TextureData.hpp b/include/TGUI/TextureData.hpp index 061f020d..690879c0 100644 --- a/include/TGUI/TextureData.hpp +++ b/include/TGUI/TextureData.hpp @@ -46,7 +46,7 @@ namespace tgui // Used by the Texture class struct TGUI_API TextureData { - std::shared_ptr image; + std::unique_ptr image; sf::Texture texture; sf::IntRect rect; }; diff --git a/src/TGUI/Texture.cpp b/src/TGUI/Texture.cpp index ab15a11c..3c1a59b5 100644 --- a/src/TGUI/Texture.cpp +++ b/src/TGUI/Texture.cpp @@ -34,9 +34,9 @@ namespace tgui { Texture::TextureLoaderFunc Texture::m_textureLoader = &TextureManager::getTexture; - Texture::ImageLoaderFunc Texture::m_imageLoader = [](const sf::String& filename) -> std::shared_ptr + Texture::ImageLoaderFunc Texture::m_imageLoader = [](const sf::String& filename) -> std::unique_ptr { - auto image = std::make_shared(); + auto image = std::make_unique(); if (image->loadFromFile(filename)) return image; else diff --git a/tests/Texture.cpp b/tests/Texture.cpp index f9bde5b7..82c58345 100644 --- a/tests/Texture.cpp +++ b/tests/Texture.cpp @@ -184,7 +184,7 @@ TEST_CASE("[Texture]") unsigned int count = 0; auto oldImageLoader = tgui::Texture::getImageLoader(); - auto func = [&](const sf::String&){ auto image=std::make_shared(); image->create(1,1); count++; return image; }; + auto func = [&](const sf::String&){ auto image=std::make_unique(); image->create(1,1); count++; return image; }; tgui::Texture::setImageLoader(func); REQUIRE_NOTHROW(tgui::Texture{"resources/image.png"}); REQUIRE(count == 1);