8000 Unable to access newly constructed AppStates · Issue #95 · cpluspluscom/ChessPlusPlus · GitHub
[go: up one dir, main page]

Skip to content
Unable to access newly constructed AppStates #95
Open
@LB--

Description

@LB--

Application::changeState() should return a reference to the new AppState instance so that calling code can interact with it beyond passing constructor arguments.

Additionally, something should be done about the destruction of the old AppState object inside the call - generally an AppState will be making the call to changeState() and will thus be destructing itself. This is dangerous even if documented.

I'm thinking of returning both the old and the new in a std::pair<std::unique_ptr<AppState>, std::reference_wrapper<NewState>> or making a simple custom struct to label them previous and current.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0