View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0038276 | Patches | IDE | public | 2020-12-29 20:21 | 2021-02-21 09:13 |
Reporter | Andrey Sobol | Assigned To | Juha Manninen | ||
Priority | normal | Severity | minor | Reproducibility | always |
Status | resolved | Resolution | fixed | ||
Platform | i386 | OS | Windows | ||
Product Version | 2.0.10 | ||||
Summary | 0038276: Lazarus hanging when lHelp starts from Menu and by F1 pressing | ||||
Description | Issue description: Lazarus IDE creates two instances of TChmHelpViewer object on start. As result we can`t start chm help from Help menu and from context search by F1 at the same time. That is I start the lHelp at first from menu, next I do a roll down (minimaze) the lHelp (not close) and press F1 for context search, I get a hanging IDE. IDE does starting another instance of IPC server with same IPC ID. That occurs because each instance of TChmHelpViewer has own THelpConnector with same IPC ID. The reverse situation also exists. F1 - minimaze lHelp - choose Help menu - crash. Fixes: 1. I done a singleton for TChmHelpViewer object instance. 2. Moved a checking of rebuild lHelp to after checking connection (for uniformity). 3. Made a starting of lHelp on each choosing of help menu for display full help. I Think it fix and the fix (tranc rev.64159) need transfer to fixes_2_0 branch it is terrible mistakes. Patch attached | ||||
Tags | No tags attached. | ||||
Fixed in Revision | r64306 | ||||
LazTarget | - | ||||
Widgetset | |||||
Attached Files |
|
related to | 0038154 | resolved | Juha Manninen | Packages | lHelp freezes when I have same documention into html directory and as chm file. |
related to | 0037244 | resolved | Juha Manninen | Lazarus | Clicking 'Help' from Lazarus Help menu causes error and empty help viewer |
|
idehelp.patch (6,237 bytes)
Index: lazchmhelp.pas =================================================================== --- lazchmhelp.pas (revision 64169) +++ lazchmhelp.pas (working copy) @@ -114,8 +114,13 @@ procedure Register; +function ChmViewerInstance(): TChmHelpViewer; + implementation +var + ChmHelpViewer: TChmHelpViewer; + const // Part of help name. Stored/retrieved in Lazarus options CHMHelp/Name. // Do not localize. @@ -133,16 +138,16 @@ procedure Register; var - ChmHelp: TChmHelpViewer; + ChmViewer: TChmHelpViewer; begin - ChmHelp := TChmHelpViewer.Create(nil); - HelpViewers.RegisterViewer(ChmHelp); + ChmViewer := ChmViewerInstance(); + HelpViewers.RegisterViewer(ChmViewer); RegisterLangRefHelpDatabase; - LangRefHelpDatabase.OnFindViewer := @ChmHelp.DBFindViewer; + LangRefHelpDatabase.OnFindViewer := @ChmViewer.DBFindViewer; RegisterLclHelpDatabase; - LCLHelpDatabase.OnFindViewer := @ChmHelp.DBFindViewer; + LCLHelpDatabase.OnFindViewer := @ChmViewer.DBFindViewer; RegisterFPCDirectivesHelpDatabase; - FPCDirectivesHelpDatabase.OnFindViewer := @ChmHelp.DBFindViewer; + FPCDirectivesHelpDatabase.OnFindViewer := @ChmViewer.DBFindViewer; // disable showing CodeBrowser on unknown identifiers. LHelp has its own // search function. @@ -149,6 +154,12 @@ LazarusHelp.ShowCodeBrowserOnUnknownIdentifier:=false; end; +function ChmViewerInstance ( ): TChmHelpViewer; +begin + if not Assigned (ChmHelpViewer) then + ChmHelpViewer:= TChmHelpViewer.Create(nil); + Result:= ChmHelpViewer; +end; { TChmHelpViewer } @@ -515,43 +526,42 @@ SearchPath: String; //; delimited list of directories HelpExeFileName: String; begin - // Make sure the lhelp help viewer exists; build it if doesn't and it is lhelp HelpExeFileName:=GetHelpExe; - if (not FileExistsUTF8(HelpExeFileName)) and - ((ExtractFileNameOnly(HelpExeFileName) = 'lhelp') and - (CheckBuildLHelp <> mrOK)) then - begin - IDEMessageDialog(HELP_MissingLhelp, - Format(HELP_UnableToFindTheLhelpViewerPleaseCompileTheLhelpPro, - [LineEnding, HelpExeFileName, LineEnding+LineEnding, LineEnding, - GetForcedPathDelims('components/chmhelp/lhelp/lhelp.lpi')]), - mtError,[mbCancel]); - Debugln(Format('ChmHelpViewer: '+HELP_UnableToFindTheLhelpViewerPleaseCompileTheLhelpPro, - [LineEnding, HelpExeFileName, LineEnding+LineEnding, LineEnding, - GetForcedPathDelims('components/chmhelp/lhelp/lhelp.lpi')])); - exit; - end; + SearchPath := GetHelpFilesPath; - SearchPath := GetHelpFilesPath; - // Start up help viewer if needed - and tell it to hide if not(fHelpConnection.ServerRunning) then begin + // Make sure the lhelp help viewer exists; build it if doesn't and it is lhelp + if (not FileExistsUTF8(HelpExeFileName)) and + ((ExtractFileNameOnly(HelpExeFileName) = 'lhelp') and + (CheckBuildLHelp <> mrOK)) then + begin + IDEMessageDialog(HELP_MissingLhelp, + Format(HELP_UnableToFindTheLhelpViewerPleaseCompileTheLhelpPro, + [LineEnding, HelpExeFileName, LineEnding+LineEnding, LineEnding, + GetForcedPathDelims('components/chmhelp/lhelp/lhelp.lpi')]), + mtError,[mbCancel]); + Debugln(Format('ChmHelpViewer: '+HELP_UnableToFindTheLhelpViewerPleaseCompileTheLhelpPro, + [LineEnding, HelpExeFileName, LineEnding+LineEnding, LineEnding, + GetForcedPathDelims('components/chmhelp/lhelp/lhelp.lpi')])); + exit; + end; + // Start up help viewer if needed - and tell it to hide fHelpConnection.StartHelpServer(HelpLabel, HelpExeFileName, true); Response := fHelpConnection.RunMiscCommand(mrVersion); if Response <> srSuccess then begin - debugln('TChmHelpViewer: Help viewer does not support our protocol version ('+PROTOCOL_VERSION +'). Response was: ord: '+inttostr(ord(Response))) - end - else - begin - // Open all chm files after it has started, while still hidden - OpenAllCHMsInSearchPath(SearchPath); - // Instruct viewer to show its GUI - Response := fHelpConnection.RunMiscCommand(mrShow); - if Response <> srSuccess then - debugln('TChmHelpViewer: Help viewer gave error response to mrShow command. Response was: ord: '+inttostr(ord(Response))); + debugln('TChmHelpViewer: Help viewer does not support our protocol version ('+ + PROTOCOL_VERSION +'). Response was: ord: '+inttostr(ord(Response))); + Exit; end; end; + // Open all chm files always + OpenAllCHMsInSearchPath(SearchPath); + // Instruct viewer to show its GUI + Response := fHelpConnection.RunMiscCommand(mrShow); + if Response <> srSuccess then + debugln('TChmHelpViewer: Help viewer gave error response to mrShow command. Response was: ord: '+inttostr(ord(Response))); end; function TChmHelpViewer.ShowNode(Node: THelpNode; var ErrMsg: string Index: lazchmhelpregister.pas =================================================================== --- lazchmhelpregister.pas (revision 64169) +++ lazchmhelpregister.pas (working copy) @@ -42,10 +42,7 @@ HELP_CURRENT_NAME = 'chpHelp'; HELP_CATEGORY_IDECMD_NAME = 'chpFormat'; -var - IDECHMHelp: TChmHelpViewer; - - +// Register package procedure Register; var Cat: TIDECommandCategory; @@ -53,10 +50,11 @@ Key: TIDEShortCut; } CmdHelpCommand: TIDECommand; + AChmViewer: TChmHelpViewer; begin // We can't put this in an initialization section because IDEChmHelp requires // some IDE features, which are only available in "Register". - IDECHMHelp := TChmHelpViewer.Create(nil); + AChmViewer := ChmViewerInstance(); Cat := IDECommandList.CreateCategory(nil, HELP_CATEGORY_IDECMD_NAME, HELP_CATEGORY_IDECMD, IDECmdScopeSrcEditOnly); { @@ -66,13 +64,9 @@ @IDECHMHelp.ShowAllHelp); } CmdHelpCommand := RegisterIDECommand(Cat, HELP_CURRENT_NAME, HELP_CURRENT_IDECMD, - @IDECHMHelp.ShowAllHelp); - + @AChmViewer.ShowAllHelp); RegisterIDEMenuCommand(mnuHelp, HELP_CURRENT_NAME, HELP_CURRENT_MENU, - @IDECHMHelp.ShowAllHelp, nil, CmdHelpCommand); + @AChmViewer.ShowAllHelp, nil, CmdHelpCommand); end; - -finalization - FreeAndNil(IDECHMHelp); end. |
|
I think that https://bugs.freepascal.org/view.php?id=38154 is a related issue. |
|
I applied the patch in r64306. Thanks. Does it fix the related issue, too? I hope Lazarus fixes_2_2 branch is forked soon. Let's try to improve lHelp for that. |
|
Yes, I checked the associated problem also. You can close both issues. That was a side affect from this issue. |
|
Resolving... |
|
I think this patch need to apply in the fixes_2_0 also Thanks. |
Date Modified | Username | Field | Change |
---|---|---|---|
2020-12-29 20:21 | Andrey Sobol | New Issue | |
2020-12-29 20:21 | Andrey Sobol | File Added: idehelp.patch | |
2020-12-29 20:24 | Andrey Sobol | Note Added: 0127914 | |
2020-12-30 00:08 | Juha Manninen | Relationship added | related to 0038154 |
2020-12-30 00:28 | Juha Manninen | Assigned To | => Juha Manninen |
2020-12-30 00:28 | Juha Manninen | Status | new => assigned |
2020-12-30 00:31 | Juha Manninen | Status | assigned => feedback |
2020-12-30 00:31 | Juha Manninen | LazTarget | => - |
2020-12-30 00:31 | Juha Manninen | Note Added: 0127922 | |
2020-12-30 12:18 | Andrey Sobol | Note Added: 0127932 | |
2020-12-30 12:18 | Andrey Sobol | Status | feedback => assigned |
2020-12-30 12:32 | Juha Manninen | Status | assigned => resolved |
2020-12-30 12:32 | Juha Manninen | Resolution | open => fixed |
2020-12-30 12:32 | Juha Manninen | Fixed in Revision | => r64306 |
2020-12-30 12:32 | Juha Manninen | Note Added: 0127934 | |
2021-02-06 16:39 | Andrey Sobol | Note Added: 0128797 | |
2021-02-06 17:16 | Andrey Sobol | Note Edited: 0128797 | View Revisions |
2021-02-21 09:13 | Juha Manninen | Relationship added | related to 0037244 |