[Lazarus] Crash on OSX because of postponed double click processing

Martin Grajcar maaartinus at gmail.com
Sun Aug 2 05:12:28 CEST 2015


Our application crashes on OSX because of the event processing in function
CarbonWindow_MouseProc(ANextHandler: EventHandlerCallRef; at
lcl/interfaces/carbon/carbonprivatewindow.inc:329

  if Postpone then
  begin
    PostponedDown := True;
    PostponedDownMsg := TLMMouse(Msg.Message);
    Result := CallNextEventHandler(ANextHandler, AEvent);
  end
  else
  begin
  ...
  end;

  // interactive design
  if (EventKind = kEventMouseDown)
  and Assigned(Widget.LCLObject)
  and ((csDesigning in Widget.LCLObject.ComponentState) or (Widget is
TCarbonDesignWindow))
  and (GetCarbonMouseButton(AEvent) = 1) then

When double clicking on a custom component of ours, an ancestor of the
component gets hidden and something else gets shown. Unfortunately, this
hiding seems to happen in the call to CallNextEventHandler. During this the
Widget gets freed, its Widget.LCLObject overwritten by some non-sense (e.g.
$ffffffff), and Widget.LCLObject.ComponentState crashes.

This doesn't happen on Linux.

1. Is the a bug in Carbon or are we doing something wrong? I don't yet
understand how our hiding code exactly works.
2. What's the best fix?

Regards,
Martin.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20150802/ef28d32e/attachment-0002.html>


More information about the Lazarus mailing list