I am having an issue with focus change and mouse events. This is the gist of the events:
When
ComponentAlooses focus,ComponentBis destroyed and rebuilt with some new state.
The crux of the issue is this:
ComponentBis clicked.ComponentB::internalMouseDowncauses a focus change.ComponentA::focusLostdestroys and replacesComponentB.- Returns to
ComponentB’s scope with an invalidthispointer to complete the Mouse event.
I assumed that focus events were processed separate, placed in the event queue along with mouse events. This would allow the focus event to destroy and rebuild Component B, then a mouse event to be posted to the actual component under the mouse at time of sending or to realize that the component it was posted to is no longer valid. Or vice versa with mouse event first.
I have a fix for this in my code that avoids it in this one particular case, but its not a very strong guarantee that it won’t happen again.
Should I be coding as if focus changes are not allowed to change program state outside of the component they apply to?
Many thanks to the hard working developers, I am finding JUCE very usable. ![]()
