diff options
author | Bartosz Taudul <wolf@nereid.pl> | 2022-07-26 02:38:19 +0300 |
---|---|---|
committer | Bartosz Taudul <wolf@nereid.pl> | 2022-07-28 01:24:48 +0300 |
commit | 2c31ba8016ef31d072a0ca6e35db725cebe2a294 (patch) | |
tree | e2603582daba96dd418863a62a7ad99080f7752a /profiler | |
parent | add5c1e328f125e6554b2ab677cfb64169e89c60 (diff) |
Don't free icon pixel data.
Diffstat (limited to 'profiler')
-rw-r--r-- | profiler/src/main.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/profiler/src/main.cpp b/profiler/src/main.cpp index 77fd180f..58934b72 100644 --- a/profiler/src/main.cpp +++ b/profiler/src/main.cpp @@ -118,6 +118,8 @@ static RunQueue mainThreadTasks; static uint32_t updateVersion = 0; static bool showReleaseNotes = false; static std::string releaseNotes; +static uint8_t* iconPx; +static int iconX, iconY; void RunOnMainThread( std::function<void()> cb, bool forceDelay = false ) { @@ -228,11 +230,14 @@ int main( int argc, char** argv ) GLFWwindow* window = glfwCreateWindow( winPos.w, winPos.h, title, NULL, NULL); if( !window ) return 1; + iconPx = stbi_load_from_memory( (const stbi_uc*)Icon_data, Icon_size, &iconX, &iconY, nullptr, 4 ); + { GLFWimage icon; - icon.pixels = stbi_load_from_memory( (const stbi_uc*)Icon_data, Icon_size, &icon.width, &icon.height, nullptr, 4 ); + icon.width = iconX; + icon.height = iconY; + icon.pixels = iconPx; glfwSetWindowIcon( window, 1, &icon ); - free( icon.pixels ); } glfwSetWindowPos( window, winPos.x, winPos.y ); @@ -344,6 +349,7 @@ int main( int argc, char** argv ) #endif glfwTerminate(); + free( iconPx ); return 0; } |