fix: Delete splash textures before destroying splash screen
This commit is contained in:
parent
ef2373e8c0
commit
098da20761
@ -79,17 +79,16 @@ namespace ImGuiExt {
|
||||
Texture(const Texture&) = delete;
|
||||
Texture(Texture&& other) noexcept;
|
||||
|
||||
[[nodiscard]] static Texture fromImage(const ImU8 *buffer, int size, Filter filter = Filter::Nearest);
|
||||
[[nodiscard]] static Texture fromImage(std::span<const std::byte> buffer, Filter filter = Filter::Nearest);
|
||||
[[nodiscard]] static Texture fromImage(const char *path, Filter filter = Filter::Nearest);
|
||||
[[nodiscard]] static Texture fromImage(const std::fs::path &path, Filter filter = Filter::Nearest);
|
||||
[[nodiscard]] static Texture fromGLTexture(unsigned int texture, int width, int height);
|
||||
[[nodiscard]] static Texture fromBitmap(const ImU8 *buffer, int size, int width, int height, Filter filter = Filter::Nearest);
|
||||
[[nodiscard]] static Texture fromBitmap(std::span<const std::byte> buffer, int width, int height, Filter filter = Filter::Nearest);
|
||||
[[nodiscard]] static Texture fromSVG(const char *path, int width = 0, int height = 0, Filter filter = Filter::Nearest);
|
||||
[[nodiscard]] static Texture fromSVG(const std::fs::path &path, int width = 0, int height = 0, Filter filter = Filter::Nearest);
|
||||
[[nodiscard]] static Texture fromSVG(std::span<const std::byte> buffer, int width = 0, int height = 0, Filter filter = Filter::Nearest);
|
||||
|
||||
[[nodiscard]] static Texture fromImage(const ImU8 *buffer, int size, Filter filter = Filter::Nearest);
|
||||
[[nodiscard]] static Texture fromImage(std::span<const std::byte> buffer, Filter filter = Filter::Nearest);
|
||||
[[nodiscard]] static Texture fromImage(const char *path, Filter filter = Filter::Nearest);
|
||||
[[nodiscard]] static Texture fromImage(const std::fs::path &path, Filter filter = Filter::Nearest);
|
||||
[[nodiscard]] static Texture fromGLTexture(unsigned int texture, int width, int height);
|
||||
[[nodiscard]] static Texture fromBitmap(const ImU8 *buffer, int size, int width, int height, Filter filter = Filter::Nearest);
|
||||
[[nodiscard]] static Texture fromBitmap(std::span<const std::byte> buffer, int width, int height, Filter filter = Filter::Nearest);
|
||||
[[nodiscard]] static Texture fromSVG(const char *path, int width = 0, int height = 0, Filter filter = Filter::Nearest);
|
||||
[[nodiscard]] static Texture fromSVG(const std::fs::path &path, int width = 0, int height = 0, Filter filter = Filter::Nearest);
|
||||
[[nodiscard]] static Texture fromSVG(std::span<const std::byte> buffer, int width = 0, int height = 0, Filter filter = Filter::Nearest);
|
||||
|
||||
~Texture();
|
||||
|
||||
@ -114,6 +113,8 @@ namespace ImGuiExt {
|
||||
return float(m_width) / float(m_height);
|
||||
}
|
||||
|
||||
void reset();
|
||||
|
||||
private:
|
||||
ImTextureID m_textureId = 0;
|
||||
int m_width = 0, m_height = 0;
|
||||
|
@ -284,10 +284,14 @@ namespace ImGuiExt {
|
||||
}
|
||||
|
||||
Texture::~Texture() {
|
||||
if (m_textureId == 0)
|
||||
return;
|
||||
this->reset();
|
||||
}
|
||||
|
||||
glDeleteTextures(1, reinterpret_cast<GLuint*>(&m_textureId));
|
||||
void Texture::reset() {
|
||||
if (m_textureId != 0) {
|
||||
glDeleteTextures(1, reinterpret_cast<GLuint*>(&m_textureId));
|
||||
m_textureId = 0;
|
||||
}
|
||||
}
|
||||
|
||||
float GetTextWrapPos() {
|
||||
|
@ -65,6 +65,10 @@ namespace hex::init {
|
||||
}
|
||||
|
||||
WindowSplash::~WindowSplash() {
|
||||
// Clear textures before deinitializing glfw
|
||||
m_splashBackgroundTexture.reset();
|
||||
m_splashTextTexture.reset();
|
||||
|
||||
this->exitImGui();
|
||||
this->exitGLFW();
|
||||
}
|
||||
@ -584,7 +588,6 @@ namespace hex::init {
|
||||
|
||||
void WindowSplash::exitGLFW() const {
|
||||
glfwDestroyWindow(m_window);
|
||||
glfwTerminate();
|
||||
}
|
||||
|
||||
void WindowSplash::exitImGui() const {
|
||||
|
Loading…
x
Reference in New Issue
Block a user