Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug fix/text input disabled #1646

Merged
merged 1 commit into from
Feb 27, 2025
Merged

Bug fix/text input disabled #1646

merged 1 commit into from
Feb 27, 2025

Conversation

oscar139
Copy link
Contributor

@oscar139 oscar139 commented Feb 26, 2025

In rearranging the calls to initialize ~MapViewState no longer leaves the status of SDL_TextInput off. This had the side effect of causing the NAS2D::Utility<StructureManager>::get().dropAllStructures(); in MapViewState::load where StructureManager was still populated with pointers from objects from the now deleted MapViewState.

Edit:
New strategy. I do not see any advantage of disabling SDL_TextInput by ~MapViewState.

@oscar139 oscar139 requested a review from DanRStevens February 26, 2025 19:40
Copy link
Member

@DanRStevens DanRStevens left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The second commit looks like the actual fix. The first commit I think may have some unintended consequences.

@oscar139 oscar139 force-pushed the BugFix/TextInput-Disabled branch from 93f9d2e to c4efb11 Compare February 27, 2025 11:19
Copy link
Member

@DanRStevens DanRStevens left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can accept this. Maybe slightly odd that we enable text input mode in two places, which can be called multiple times, and never disable it anywhere. But then given how we're using it, there's not really an obvious better solution. Particularly since text input mode is an on/off switch, without any kind of reference counting, and our calls to turn it on (and potentially off) are by classes that may have multiple instances, and those instances won't know about each other.

I'm wondering if it would make sense to enable text input mode globally somewhere early during app loading, and never touching it again.

@DanRStevens DanRStevens merged commit 031ecf8 into main Feb 27, 2025
7 checks passed
@DanRStevens DanRStevens deleted the BugFix/TextInput-Disabled branch February 27, 2025 12:34
@oscar139 oscar139 mentioned this pull request Feb 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants