mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-17 23:29:25 +02:00
Gtk3: fixed crash if handle vanish during input event.issue #41449
This commit is contained in:
parent
5710c5537a
commit
d8cd947b55
@ -2299,6 +2299,7 @@ var
|
||||
MsgPopup : TLMMouse;
|
||||
MousePos: TPoint;
|
||||
MButton: guint;
|
||||
SavedHandle: PtrUInt;
|
||||
begin
|
||||
Result := False;
|
||||
{$IF DEFINED(GTK3DEBUGEVENTS) OR DEFINED(GTK3DEBUGMOUSE)}
|
||||
@ -2309,6 +2310,8 @@ begin
|
||||
if Event^.button.send_event = NO_PROPAGATION_TO_PARENT then
|
||||
exit;
|
||||
|
||||
SavedHandle := PtrUInt(Self);
|
||||
|
||||
FillChar(Msg{%H-}, SizeOf(Msg), #0);
|
||||
|
||||
MousePos.x := Round(Event^.button.x);
|
||||
@ -2395,6 +2398,9 @@ begin
|
||||
Event^.button.send_event := NO_PROPAGATION_TO_PARENT;
|
||||
|
||||
Result := False;
|
||||
if SavedHandle <> PtrUInt(Self) then
|
||||
exit;
|
||||
|
||||
if Msg.Msg = LM_RBUTTONDOWN then
|
||||
begin
|
||||
MsgPopup := Msg;
|
||||
@ -2402,9 +2408,17 @@ begin
|
||||
MsgPopup.XPos := SmallInt(Round(Event^.button.x_root));
|
||||
MsgPopup.YPos := SmallInt(Round(Event^.button.y_root));
|
||||
DeliverMessage(MsgPopup, True);
|
||||
if SavedHandle <> PtrUInt(Self) then
|
||||
exit;
|
||||
end;
|
||||
|
||||
if not Result then
|
||||
begin
|
||||
Result := DeliverMessage(Msg, True) <> 0;
|
||||
if SavedHandle <> PtrUInt(Self) then
|
||||
exit;
|
||||
end;
|
||||
|
||||
if Event^.type_ = GDK_BUTTON_RELEASE then
|
||||
begin
|
||||
Msg.Msg := LM_CLICKED;
|
||||
|
Loading…
Reference in New Issue
Block a user