mirror of
				https://github.com/Drezil/imgui.git
				synced 2025-11-03 22:51:06 +01:00 
			
		
		
		
	Delete font clear pointer in ImGui state to get a clear crasah instead of a dangling pointer. #181
This commit is contained in:
		
							
								
								
									
										10
									
								
								imgui.cpp
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								imgui.cpp
									
									
									
									
									
								
							@@ -8264,6 +8264,16 @@ ImFont::ImFont()
 | 
			
		||||
    Clear();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
ImFont::~ImFont()
 | 
			
		||||
{
 | 
			
		||||
    // Invalidate active font so that the user gets a clear crash instead of a dangling pointer.
 | 
			
		||||
    // If you want to delete fonts you need to do it between Render() and NewFrame().
 | 
			
		||||
    ImGuiState& g = *GImGui;
 | 
			
		||||
    if (g.Font == this)
 | 
			
		||||
        g.Font = NULL;
 | 
			
		||||
    Clear();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void    ImFont::Clear()
 | 
			
		||||
{
 | 
			
		||||
    FontSize = 0.0f;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user