Browse Source

fix errors when reloading font textures

Jeffery Myers 4 tháng trước cách đây
mục cha
commit
ac98b6c712
1 tập tin đã thay đổi với 8 bổ sung0 xóa
  1. 8 0
      rlImGui.cpp

+ 8 - 0
rlImGui.cpp

@@ -679,7 +679,12 @@ void ImGui_ImplRaylib_Shutdown()
             {
                 UnloadTexture(*backendData);
             }
+            if (backendData)
+                MemFree(backendData);
+
+            texture->BackendUserData = nullptr;
             texture->Status = ImTextureStatus_Destroyed;
+			texture->SetTexID(ImTextureID_Invalid);
         }
     }
 
@@ -738,6 +743,9 @@ void ImGui_ImplRaylib_UpdateTexture(ImTextureData* tex)
                 break;
             UnloadTexture(*texture);
             tex->Status = ImTextureStatus_Destroyed;
+            MemFree(texture);
+            tex->BackendUserData = nullptr;
+            tex->SetTexID(ImTextureID_Invalid);
         }
         break;
     }