View Issue Details

IDProjectCategoryView StatusLast Update
0022592LazarusIDEpublic2018-01-31 14:15
ReporterPhilAssigned ToMartin Friebe 
Status resolvedResolutionfixed 
PlatformWindowsOSWindows 7OS VersionWindows 7
Product Version1.0.0RC1Product Build 
Target VersionFixed in Version 
Summary0022592: lhelp About box hangs app
DescriptionSomething very odd with the lhelp app's About box - unable to close it until many clicks / long delay.

TagsNo tags attached.
Fixed in Revision38285
Attached Files


Mattias Gaertner

2012-08-07 09:35

manager   ~0061459

The lhelp about dialog is a Application.MessageBox call, which is under a win32/64 a call of MessageDlg.

Does this happen when you start components/chmhelp/lhelp/lhelp.exe directly too?


2012-08-07 15:36

reporter   ~0061482

About box appears to close normally when lhelp is started independent of Lazarus.

Note that pressing Esc in About box shuts down lhelp altogether. Surely that's not correct. (Esc does nothing in lhelp launched from Laz help.)

Martin Friebe

2012-08-16 22:57

manager   ~0061671

Last edited: 2012-08-16 22:57

To reproduce lhelp must be started with
  --ipcname foo-bar

procedure THelpForm.ServerMessage(Sender: TObject);
is fired by a timer. This also happens, when the messagebox is shown.

However when the messagebox is shown the call to
  if fInputIPC.PeekMessage(5, True) then begin
will hang (or timeout very slow)

Mattias Gaertner

2012-08-20 13:22

manager   ~0061750

What does fInputIPC.PeekMessage under MS Windows?

Martin Friebe

2012-08-20 14:02

manager   ~0061753

Last edited: 2012-08-20 14:04

I tracked it down to
line 130
see 2 inline comments:

function TWinMsgServerComm.PeekMessage(TimeOut: Integer): Boolean;
  Msg : Tmsg;
  B : Boolean;
  R : DWORD;

  If Result then
// Next line returns OK, (immediately)
  B:=Windows.PeekMessage(Msg, FHWND, 0, 0, PM_NOREMOVE);
  If not B then
    // No message yet. Wait for a message to arrive available within specified time.
    if (TimeOut=0) then
// Next line hangs, seems related to other msg.
// e.g. returns, when clicking taskbar-button

MsgWaitForMultipleObjects according to msdn can be called with 0 as timeout. Then it will never wait.
But I have not tested this.

procedure THelpForm.AboutItemClick(Sender: TObject);
  Application.MessageBox('LHelp (CHM file viewer)'0000013 +
    'Ver. 2009.06.08'0000013 +
    'Copyright (C) Andrew Haines',
    'About', 0);

I do not know what MessageBox does. But windows does start a 2nd thread for that. So maybe its a syncronize issue.

I also notige that Application.Crocessmessages (if I am correct) does a PeekMessage(xxx, nil... which means *all* handles, and therefore would include this? But I am not sure....

I can thing of:

Not calling this while showing about box

  B:=Windows.PeekMessage(Msg, FHWND, 0, 0, PM_NOREMOVE);
in the app, and if there is no message, then do not call the code (saves 5 msec timeout)
(Variables are private, so a lot of work / replace class, copy paste)

Not use Application.MessageBox, but show some ModalForm

Mattias Gaertner

2012-08-20 14:16

manager   ~0061754

Does it work, when replaced with MessageDlg or QuestionDlg?

Martin Friebe

2012-08-20 15:15

manager   ~0061757

Same result for all.
The all end up calling "TaskDialogIndirect"

Also tried PromptUser

Martin Friebe

2012-08-20 15:36

manager   ~0061759

Replaced with custom form, and ShowModal. Please test with 38285

Issue History

Date Modified Username Field Change
2012-08-06 22:41 Phil New Issue
2012-08-06 22:41 Phil Widgetset => Win32/Win64
2012-08-07 09:35 Mattias Gaertner Note Added: 0061459
2012-08-07 15:36 Phil Note Added: 0061482
2012-08-16 22:57 Martin Friebe Note Added: 0061671
2012-08-16 22:57 Martin Friebe Note Edited: 0061671
2012-08-20 13:22 Mattias Gaertner Note Added: 0061750
2012-08-20 14:02 Martin Friebe Note Added: 0061753
2012-08-20 14:04 Martin Friebe Note Edited: 0061753
2012-08-20 14:16 Mattias Gaertner Note Added: 0061754
2012-08-20 15:15 Martin Friebe Note Added: 0061757
2012-08-20 15:32 Martin Friebe Status new => assigned
2012-08-20 15:32 Martin Friebe Assigned To => Martin Friebe
2012-08-20 15:36 Martin Friebe Fixed in Revision => 38285
2012-08-20 15:36 Martin Friebe LazTarget => 1.0
2012-08-20 15:36 Martin Friebe Status assigned => resolved
2012-08-20 15:36 Martin Friebe Resolution open => fixed
2012-08-20 15:36 Martin Friebe Note Added: 0061759
2018-01-31 14:15 Zeljan Rikalo Relationship added related to 0033104
2018-01-31 14:15 Zeljan Rikalo Relationship deleted related to 0033104