mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Component: Add more stringent checks for deleted components when handling mouse events
This commit is contained in:
parent
86d4835e2f
commit
95610e6c5e
4 changed files with 174 additions and 139 deletions
|
|
@ -259,7 +259,7 @@ struct ComponentHelpers
|
|||
for (auto& ms : Desktop::getInstance().getMouseSources())
|
||||
if (auto* c = ms.getComponentUnderMouse())
|
||||
if (modalWouldBlockComponent (*c, &modal))
|
||||
(c->*function) (ms, SH::screenPosToLocalPos (*c, ms.getScreenPosition()), Time::getCurrentTime());
|
||||
function (c, ms, SH::screenPosToLocalPos (*c, ms.getScreenPosition()), Time::getCurrentTime());
|
||||
}
|
||||
|
||||
class ModalComponentManagerChangeNotifier
|
||||
|
|
|
|||
|
|
@ -117,68 +117,76 @@ public:
|
|||
void sendMouseEnter (Component& comp, const detail::PointerState& pointerState, Time time)
|
||||
{
|
||||
JUCE_MOUSE_EVENT_DBG ("enter", pointerState.position)
|
||||
comp.internalMouseEnter (MouseInputSource (this),
|
||||
SH::screenPosToLocalPos (comp, pointerState.position),
|
||||
time);
|
||||
Component::internalMouseEnter (&comp,
|
||||
MouseInputSource (this),
|
||||
SH::screenPosToLocalPos (comp, pointerState.position),
|
||||
time);
|
||||
}
|
||||
|
||||
void sendMouseExit (Component& comp, const detail::PointerState& pointerState, Time time)
|
||||
{
|
||||
JUCE_MOUSE_EVENT_DBG ("exit", pointerState.position)
|
||||
comp.internalMouseExit (MouseInputSource (this),
|
||||
SH::screenPosToLocalPos (comp, pointerState.position),
|
||||
time);
|
||||
Component::internalMouseExit (&comp,
|
||||
MouseInputSource (this),
|
||||
SH::screenPosToLocalPos (comp, pointerState.position),
|
||||
time);
|
||||
}
|
||||
|
||||
void sendMouseMove (Component& comp, const detail::PointerState& pointerState, Time time)
|
||||
{
|
||||
JUCE_MOUSE_EVENT_DBG ("move", pointerState.position)
|
||||
comp.internalMouseMove (MouseInputSource (this),
|
||||
SH::screenPosToLocalPos (comp, pointerState.position),
|
||||
time);
|
||||
Component::internalMouseMove (&comp,
|
||||
MouseInputSource (this),
|
||||
SH::screenPosToLocalPos (comp, pointerState.position),
|
||||
time);
|
||||
}
|
||||
|
||||
void sendMouseDown (Component& comp, const detail::PointerState& pointerState, Time time)
|
||||
{
|
||||
JUCE_MOUSE_EVENT_DBG ("down", pointerState.position)
|
||||
comp.internalMouseDown (MouseInputSource (this),
|
||||
pointerState.withPosition (SH::screenPosToLocalPos (comp, pointerState.position)),
|
||||
time);
|
||||
Component::internalMouseDown (&comp,
|
||||
MouseInputSource (this),
|
||||
pointerState.withPosition (SH::screenPosToLocalPos (comp, pointerState.position)),
|
||||
time);
|
||||
}
|
||||
|
||||
void sendMouseDrag (Component& comp, const detail::PointerState& pointerState, Time time)
|
||||
{
|
||||
JUCE_MOUSE_EVENT_DBG ("drag", pointerState.position)
|
||||
comp.internalMouseDrag (MouseInputSource (this),
|
||||
pointerState.withPosition (SH::screenPosToLocalPos (comp, pointerState.position)),
|
||||
time);
|
||||
Component::internalMouseDrag (&comp,
|
||||
MouseInputSource (this),
|
||||
pointerState.withPosition (SH::screenPosToLocalPos (comp, pointerState.position)),
|
||||
time);
|
||||
}
|
||||
|
||||
void sendMouseUp (Component& comp, const detail::PointerState& pointerState, Time time, ModifierKeys oldMods)
|
||||
{
|
||||
JUCE_MOUSE_EVENT_DBG ("up", pointerState.position)
|
||||
comp.internalMouseUp (MouseInputSource (this),
|
||||
pointerState.withPosition (SH::screenPosToLocalPos (comp, pointerState.position)),
|
||||
time,
|
||||
oldMods);
|
||||
Component::internalMouseUp (&comp,
|
||||
MouseInputSource (this),
|
||||
pointerState.withPosition (SH::screenPosToLocalPos (comp, pointerState.position)),
|
||||
time,
|
||||
oldMods);
|
||||
}
|
||||
|
||||
void sendMouseWheel (Component& comp, Point<float> screenPos, Time time, const MouseWheelDetails& wheel)
|
||||
{
|
||||
JUCE_MOUSE_EVENT_DBG ("wheel", screenPos)
|
||||
comp.internalMouseWheel (MouseInputSource (this),
|
||||
SH::screenPosToLocalPos (comp, screenPos),
|
||||
time,
|
||||
wheel);
|
||||
Component::internalMouseWheel (&comp,
|
||||
MouseInputSource (this),
|
||||
SH::screenPosToLocalPos (comp, screenPos),
|
||||
time,
|
||||
wheel);
|
||||
}
|
||||
|
||||
void sendMagnifyGesture (Component& comp, Point<float> screenPos, Time time, float amount)
|
||||
{
|
||||
JUCE_MOUSE_EVENT_DBG ("magnify", screenPos)
|
||||
comp.internalMagnifyGesture (MouseInputSource (this),
|
||||
SH::screenPosToLocalPos (comp, screenPos),
|
||||
time,
|
||||
amount);
|
||||
Component::internalMagnifyGesture (&comp,
|
||||
MouseInputSource (this),
|
||||
SH::screenPosToLocalPos (comp, screenPos),
|
||||
time,
|
||||
amount);
|
||||
}
|
||||
|
||||
#undef JUCE_MOUSE_EVENT_DBG
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue