View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0022592LazarusIDEpublic2012-08-06 22:412012-08-20 15:36
ReporterPhil 
Assigned ToMartin Friebe 
PrioritynormalSeverityminorReproducibilityalways
StatusresolvedResolutionfixed 
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
LazTarget1.0
WidgetsetWin32/Win64
Attached Files

- Relationships

-  Notes
(0061459)
Mattias Gaertner (manager)
2012-08-07 09:35

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?
(0061482)
Phil (reporter)
2012-08-07 15:36

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.)
(0061671)
Martin Friebe (manager)
2012-08-16 22:57
edited on: 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)

(0061750)
Mattias Gaertner (manager)
2012-08-20 13:22

What does fInputIPC.PeekMessage under MS Windows?
(0061753)
Martin Friebe (manager)
2012-08-20 14:02
edited on: 2012-08-20 14:04

I tracked it down to
packages\fcl-process\src\win\simpleipc.inc
line 130
see 2 inline comments:


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

begin
  Result:=FDataPushed;
  If Result then
    Exit;
//////*************
// 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.
    begin
    if (TimeOut=0) then
      TimeOut:=Integer(INFINITE);
//////*************
// Next line hangs, seems related to other msg.
// e.g. returns, when clicking taskbar-button
    R:=MsgWaitForMultipleObjects(1,FHWND,False,TimeOut,QS_SENDMESSAGE);
    B:=(R<>WAIT_TIMEOUT);
    end;

------------------------
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);
begin
  Application.MessageBox('LHelp (CHM file viewer)'0000013 +
    'Ver. 2009.06.08'0000013 +
    'Copyright (C) Andrew Haines',
    'About', 0);
end;

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:

1)
Not calling this while showing about box

2)
Testing
  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)

3)
Not use Application.MessageBox, but show some ModalForm

(0061754)
Mattias Gaertner (manager)
2012-08-20 14:16

Does it work, when replaced with MessageDlg or QuestionDlg?
(0061757)
Martin Friebe (manager)
2012-08-20 15:15

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

Also tried PromptUser
(0061759)
Martin Friebe (manager)
2012-08-20 15:36

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



MantisBT 1.2.12[^]
Copyright © 2000 - 2012 MantisBT Group
Powered by Mantis Bugtracker