View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0038102 | Patches | Patch | public | 2020-11-19 05:33 | 2020-11-19 20:41 |
Reporter | Andrey Sobol | Assigned To | Bart Broersma | ||
Priority | normal | Severity | minor | Reproducibility | always |
Status | resolved | Resolution | duplicate | ||
Platform | i386 | OS | Windows | ||
Product Version | 2.0.10 | ||||
Summary | 0038102: Fix issue 0029747 | ||||
Description | https://bugs.freepascal.org/view.php?id=29747 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. | ||||
Tags | No tags attached. | ||||
Fixed in Revision | |||||
LazTarget | - | ||||
Widgetset | |||||
Attached Files |
|
duplicate of | 0029747 | resolved | Maxim Ganetsky | Lazarus | LHelp shows empty window (if F1 context sensitive help called twice) |
|
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} |
|
Is there any reason why you don't attach this patch to the issue taht you state it fixes? |
|
I do it first time. No any reason |
|
> I do it first time. No any reason Not a problem. Can you please attach the patch to 0029747 If done so, we can close this one. Thanks in advance. |
|
The patch placed |
|
Thanks for posting the fix in 0029747. Please close this ticket. |
Date Modified | Username | Field | Change |
---|---|---|---|
2020-11-19 05:33 | Andrey Sobol | New Issue | |
2020-11-19 05:33 | Andrey Sobol | File Added: idehelp_start_server_fix.patch | |
2020-11-19 10:59 | Juha Manninen | Relationship added | related to 0029747 |
2020-11-19 12:12 | Bart Broersma | Status | new => feedback |
2020-11-19 12:12 | Bart Broersma | LazTarget | => - |
2020-11-19 12:12 | Bart Broersma | Note Added: 0127044 | |
2020-11-19 12:17 | Andrey Sobol | Note Added: 0127046 | |
2020-11-19 12:17 | Andrey Sobol | Status | feedback => new |
2020-11-19 20:28 | Bart Broersma | Assigned To | => Bart Broersma |
2020-11-19 20:28 | Bart Broersma | Status | new => resolved |
2020-11-19 20:28 | Bart Broersma | Resolution | open => fixed |
2020-11-19 20:28 | Bart Broersma | Note Added: 0127057 | |
2020-11-19 20:29 | Bart Broersma | Status | resolved => feedback |
2020-11-19 20:29 | Bart Broersma | Resolution | fixed => open |
2020-11-19 20:34 | Andrey Sobol | Note Added: 0127059 | |
2020-11-19 20:34 | Andrey Sobol | Status | feedback => assigned |
2020-11-19 20:41 | Bart Broersma | Status | assigned => resolved |
2020-11-19 20:41 | Bart Broersma | Resolution | open => duplicate |
2020-11-19 20:41 | Bart Broersma | Note Added: 0127060 | |
2020-11-19 20:41 | Bart Broersma | Relationship replaced | duplicate of 0029747 |