View Issue Details

IDProjectCategoryView StatusLast Update
0029747LazarusIDEpublic2020-11-27 20:13
ReporterYuri Assigned ToMaxim Ganetsky  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Platformx86, x64OSWindows 
Product Version1.6 
Fixed in Version2.2 
Summary0029747: LHelp shows empty window (if F1 context sensitive help called twice)
DescriptionIf LHep window is not closed, then next context sensitive help shows window without navigation (and not shows properly help).
Steps To ReproduceFor example:
1) Put cursor on "TForm" class and press F1.
2) Do not close LHelp window. Switch window back to Lazarus.
3) Put cursor on "TThread" class (or on any else keyword) and press F1.
LHelp show glitch window.
TagsNo tags attached.
Fixed in Revision64159
LazTarget-
WidgetsetWin32/Win64
Attached Files

Relationships

has duplicate 0038102 resolvedBart Broersma Patches Fix issue 0029747 

Activities

Yuri

2016-02-27 22:30

reporter  

Marco van de Voort

2018-05-12 17:01

manager   ~0108254

Getting help again while lhelp already is open seems problematic (very slow, 5-10s+; lots of flickering)

serbod

2018-05-16 08:50

reporter   ~0108332

Slow response related to IPC.

--- lhelpcore.pas

procedure THelpForm.SendResponse(Response: DWord);
var
  Stream: TMemoryStream;
begin
  Stream := TMemoryStream.Create;
  try
    Stream.WriteDWord(Response);
    if Assigned(FOutputIPC) then
    begin
      // reset output IPC, to avoid strange behavior, that other side not receives messages
      // tested on win32
      FOutputIPC.Active := False;
      FOutputIPC.Active := True;
      FOutputIPC.SendMessage(mtUnknown, Stream);
    end;
  finally
    Stream.Free();
  end;
end;

Andrey Sobol

2020-11-19 20:33

reporter   ~0127058

Fix patch
1. The second instance of IPC server with same PID was started for second and next search processes. (If we did not closed LHELP). Then server do not answer and client waits a long time for timeout.
2. Set a additional checking serverRunning after lHelp rebuild.
3. Set always to show lHelp on new requests.
4. Changed the BeginUpdate and BeginEnd checking.
idehelp_start_server_fix.patch (4,882 bytes)   
Index: chmhelppkg.lpk
===================================================================
--- chmhelppkg.lpk	(revision 64115)
+++ chmhelppkg.lpk	(working copy)
@@ -23,7 +23,7 @@
     </CompilerOptions>
     <Description Value="IDE package to use chm help files in the IDE via the lhelp viewer."/>
     <License Value="GPL 2"/>
-    <Version Minor="2"/>
+    <Version Minor="2" Release="1"/>
     <Files Count="5">
       <Item1>
         <Filename Value="lazchmhelp.pas"/>
Index: lazchmhelp.pas
===================================================================
--- lazchmhelp.pas	(revision 64115)
+++ lazchmhelp.pas	(working copy)
@@ -565,11 +565,13 @@
   FoundFileName: String;
   LHelpPath: String;
   WasRunning: boolean;
+  UpdateStarted:Boolean;
   {$IFDEF CHMLOADTIMES}
   TotalTime: TDateTime;
   StartTime: TDateTime;
   {$ENDIF}
 begin
+  UpdateStarted := False;
   if Pos('file://', Node.URL) = 1 then
   begin
     Result := PassTheBuck(Node, ErrMsg);
@@ -608,25 +610,26 @@
   if ExtractFileNameOnly(GetHelpExe) = 'lhelp' then
   begin
     WasRunning := fHelpConnection.ServerRunning;
-    // Start server and tell it to hide
-    // No use setting cursor to hourglass as that may take as long as the
-    // waitforresponse timeout.
-    {$IFDEF CHMLOADTIMES}
-    TotalTime:=Now;
-    StartTime:=Now;
-    {$ENDIF}
-    fHelpConnection.StartHelpServer(HelpLabel, GetHelpExe, true);
-    {$IFDEF CHMLOADTIMES}
-    DebugLn(['CHMLOADTIMES: ',Format('Starting LHelp took %d ms',[DateTimeToTimeStamp(Now-StartTime).Time])]);
-    {$ENDIF}
-    // If the server is not already running, open all chm files after it has started
-    // This will allow cross-chm (LCL, FCL etc) searching and browsing in lhelp.
     if not(WasRunning) then
     begin
-      if fHelpConnection.BeginUpdate = srError then
+      // Start server and tell it to hide
+      // No use setting cursor to hourglass as that may take as long as the
+      // waitforresponse timeout.
+      {$IFDEF CHMLOADTIMES}
+      TotalTime:=Now;
+      StartTime:=Now;
+      {$ENDIF}
+      fHelpConnection.StartHelpServer(HelpLabel, GetHelpExe, true);
+      {$IFDEF CHMLOADTIMES}
+      DebugLn(['CHMLOADTIMES: ',Format('Starting LHelp took %d ms',[DateTimeToTimeStamp(Now-StartTime).Time])]);
+      {$ENDIF}
+      // If the server is not already running, open all chm files after it has started
+      // This will allow cross-chm (LCL, FCL etc) searching and browsing in lhelp.
+      UpdateStarted := (fHelpConnection.BeginUpdate = srSuccess);
+      if not UpdateStarted then
       begin
         // existing lhelp doesn't understand mrBeginUpdate and needs to be rebuilt
-        //close lhelp
+        // close lhelp
         if fHelpConnection.RunMiscCommand(LHelpControl.mrClose) <> srError then
         begin
           // force rebuild of lhelp
@@ -637,8 +640,14 @@
             // start it again
             Debugln(['TChmHelpViewer.ShowNode restarting lhelp to use updated protocols']);
             fHelpConnection.StartHelpServer(HelpLabel, GetHelpExe, true);
-            // now run begin update
-            fHelpConnection.BeginUpdate; // it inc's a value so calling it more than once doesn't hurt
+            // check running again
+            WasRunning := fHelpConnection.ServerRunning;
+            if not WasRunning then
+            begin
+              Result := shrViewerError;
+              ErrMsg := 'LHelp IPC server the starting error';
+              exit;
+            end;
           end;
         end;
       end;
@@ -649,16 +658,17 @@
       {$IFDEF CHMLOADTIMES}
       DebugLn(['CHMLOADTIMES: ',Format('Searching and Loading files took %d ms',[DateTimeToTimeStamp(Now-StartTime).Time])]);
       {$ENDIF}
-      // Instruct viewer to show its GUI
-      Response:=fHelpConnection.RunMiscCommand(mrShow);
-      if Response<>srSuccess then
-        debugln('Help viewer gave error response to mrShow command. Response was: ord: '+inttostr(ord(Response)));
     end;
-    fHelpConnection.BeginUpdate;
+    // When UpdateStarted = True then server use LHellp version 2 protocol
+    // it inc's a value so calling it more than once doesn't hurt
+    if not UpdateStarted then
+       UpdateStarted := (fHelpConnection.BeginUpdate = srSuccess);
     Response := fHelpConnection.OpenURL(FileName, Url);
-    fHelpConnection.EndUpdate;
-    if not WasRunning then
-      fHelpConnection.EndUpdate;
+    if UpdateStarted then fHelpConnection.EndUpdate;
+    // Instruct viewer to show its GUI always
+    Response:=fHelpConnection.RunMiscCommand(mrShow);
+    if Response<>srSuccess then
+      debugln('Help viewer gave error response to mrShow command. Response was: ord: '+inttostr(ord(Response)));
     {$IFDEF CHMLOADTIMES}
     DebugLn(['CHMLOADTIMES: ',Format('Total start time was %d ms',[DateTimeToTimeStamp(Now-TotalTime).Time])]);
     {$ENDIF}
idehelp_start_server_fix.patch (4,882 bytes)   

Maxim Ganetsky

2020-11-27 00:32

developer   ~0127202

Patch is applied with minor modifications, thanks.

Andrey, I added you to contributors list.

Andrey Sobol

2020-11-27 20:13

reporter   ~0127212

Thanks also.

Issue History

Date Modified Username Field Change
2016-02-27 22:30 Yuri New Issue
2016-02-27 22:30 Yuri File Added: 2016-02-28 00_13_06-LHelp - lcl [].png
2018-05-12 17:01 Marco van de Voort Note Added: 0108254
2018-05-16 08:50 serbod Note Added: 0108332
2020-11-19 10:59 Juha Manninen Relationship added related to 0038102
2020-11-19 20:33 Andrey Sobol Note Added: 0127058
2020-11-19 20:33 Andrey Sobol File Added: idehelp_start_server_fix.patch
2020-11-19 20:41 Bart Broersma Relationship replaced has duplicate 0038102
2020-11-27 00:32 Maxim Ganetsky Assigned To => Maxim Ganetsky
2020-11-27 00:32 Maxim Ganetsky Status new => resolved
2020-11-27 00:32 Maxim Ganetsky Resolution open => fixed
2020-11-27 00:32 Maxim Ganetsky Fixed in Revision => 64159
2020-11-27 00:32 Maxim Ganetsky LazTarget => -
2020-11-27 00:32 Maxim Ganetsky Widgetset Win32/Win64 => Win32/Win64
2020-11-27 00:32 Maxim Ganetsky Note Added: 0127202
2020-11-27 14:33 Maxim Ganetsky Fixed in Version => 2.2
2020-11-27 14:33 Maxim Ganetsky Widgetset Win32/Win64 => Win32/Win64
2020-11-27 20:13 Andrey Sobol Note Added: 0127212