Browse Source

No longer defaulting to calloc with the memory recycler revealed that the component state was not initialized to zero, because the type alias looked like a default initialized type.

David Piuva 1 year ago
parent
commit
c03c02380b
1 changed files with 2 additions and 1 deletions
  1. 2 1
      Source/DFPSR/gui/VisualComponent.h

+ 2 - 1
Source/DFPSR/gui/VisualComponent.h

@@ -58,7 +58,8 @@ public: // Relations
 	std::shared_ptr<VisualComponent> dragComponent;
 	std::shared_ptr<VisualComponent> dragComponent;
 private: // States
 private: // States
 	// Use methods to set the current state, then have it copied to previousState after calling updateStateEvent in sendNotifications.
 	// Use methods to set the current state, then have it copied to previousState after calling updateStateEvent in sendNotifications.
-	ComponentState currentState, previousState;
+	ComponentState currentState = 0;
+	ComponentState previousState = 0;
 private: // State updates
 private: // State updates
 	// TODO: Can a faster update be made using a limited traversal from changed component to root, while reusing the same code for the update?
 	// TODO: Can a faster update be made using a limited traversal from changed component to root, while reusing the same code for the update?
 	// Called after changing direct states.
 	// Called after changing direct states.