In /usr/share/lazarus/1.2.6/lcl/interfaces/carbon/carbonprivatewindow.inc:299
(CarbonWindow_MouseProc ) there's the following code

  while Assigned(Widget) and not Widget.IsEnabled do
  begin
    // Here we need to avoid an endless loop which might occur in case
    // GetParent returns the same widget that we passed
    lTmpWidget := TCarbonWidget(CarbonWidgetset.GetParent(HWND(Widget)));
    if lTmpWidget = Widget then Break;
    Widget := lTmpWidget;
  end;

In our application, it indeed happens somehow, that the condition lTmpWidget
= Widget holds. This test helps to break the infinite cycle, but

function TCarbonWidgetSet.GetParent(Handle: HWND): HWND;

in /usr/share/lazarus/1.2.6/lcl/interfaces/carbon/carbonwinapi.inc:1794
gets also used from elsewhere, namely
from /usr/share/lazarus/1.2.6/lcl/include/winapi.inc:432

function GetParent(Handle : HWND): HWND;

which gets used from C code handling the event loop. It looks like there's
a similar problem happening there, an endless loop keeping the CPU busy and
the application dead.

As a workaround, I appended

if Result = Handle then Result := 0;

to TCarbonWidgetSet.GetParent but this feels hacky.

My questions are:

1. Am I right assuming that a windows having itself as parent is always
wrong?
2. Is there a simple way how to find where this happens? I know it's not in
in TCarbonWidgetSet.SetParent.
3. Is my workaround correct?

Regards, Martin.
--
_______________________________________________
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to