Developer forums (C::B DEVELOPMENT STRICTLY!) > Plugins development
Code completion using LSP and clangd
Pecan:
--- Quote from: Pecan on September 13, 2022, 09:30:43 pm ---@ MaxGaspa
Until I can find the cause of the crash, you can disable Settings/Editor/GeneralSetting/Documentation popup.
This should eliminate the stall/crash. If It does not, let me know.
Thanks
--- End quote ---
RFC: patch for ticket 1168.
This is a Request For Comment for the attached patch.
I have posted a patch on the second page of ticket #1168:
Direct link to Patch
The attached patch (ccManagerMouseTrap220915-1.patch) resolves the following described conditions for both CodeCompletion and Clangd_client. The patch has been tested on both MSW and Linux.
1) The HtmlDocumentationPopup gets stuck showing and cannot be closed.
2) The user did a double-click to select from the AutocompPopup, the HtmlDocumentationPopup got left showing and CB is frozen (and may crash).
3) The AutocompPopup and the HtmlPopup are showing, the user unfocused CB then re-focused CB and CB is frozen and must be killed.
4) The user has unChecked Documentation popup in options and now AutocompPopups cannot be scrolled.
5) The AutocompPopup only is stuck showing and cannot be closed.
What is actually happening? (tldr version)
CB is getting stuck in function OnPopScroll statement:
--- Code: ---else if (m_pAutocompPopup && m_pAutocompPopup->GetScreenRect().Contains(pos))
--- End code ---
in the GetScreenRect() function because the AutocompPopup window has been hidden and the HtmlDocumentationPopup may or may not be hidden, but a wxEVT_MOUSEWHEEL connection is owned by the html popup.
It seems that wxWidgets does not like this condition.
The debugger cannot even step out of this condition.
The problem usually arises from a slower double-mouse-click on an AutocompPopup item such that the double click gets interpreted as two single-clicks.
The AutocompPopup will get closed leaving the HtmlDocumentationPopup out to dry.
Now the conditions on which ccManager depended to remove the event connection will never be met.
We than have a happy deadly embrace.
Other sequences of action also cause the deadly embrace including (occasionally) un-focusing and re-focusing CB while both popups are showing.
I didn't trace through all the conditions causing the deadly embrace since the fix to avoid connecting wxEVT_MOUSEWHEEL to HtmlPopup when AutocompPopup was hidden fixed most of the other conditions also. (ie. the first fix eliminated the possibility of the others).
I did, however, trace through all listed conditions once the fix was applied locally.
I would like to apply the patch before the next nightly.
Comments please....
ollydbg:
--- Quote ---1) The HtmlDocumentationPopup gets stuck showing and cannot be closed.
2) The user did a double-click to select from the AutocompPopup, the HtmlDocumentationPopup got left showing and CB is frozen (and may crash).
3) The AutocompPopup and the HtmlPopup are showing, the user unfocused CB then re-focused CB and CB is frozen and must be killed.
4) The user has unChecked Documentation popup in options and now AutocompPopups cannot be scrolled.
5) The AutocompPopup only is stuck showing and cannot be closed.
--- End quote ---
Hi, Pecan, good work! I see issue5 many times randomly in my daily work, but it is hard to reproduce, I even don't know how to reproduce this issue. The popup window shown on top of every application, and even CB is not focused, the popup window is still showing. What I have to do is kill the C::B process from the task manager.
Hope your fix will solve those issues, thanks!
ollydbg:
About the ccManagerMouseTrap220915-1.patch file.
I'm not sure, but this variable
--- Code: ---std::map<cbEditor*,bool> m_EdAutoCompMouseTraps;
--- End code ---
The bool value is always "true"? Since I see the only code here is:
--- Code: ---m_EdAutoCompMouseTraps[ed] = true;
--- End code ---
Also, is the code Windows related? If yes, I think the "#ifdef __WXMSW__" should also be placed in the header file around this member variable declaration.
Pecan:
--- Quote from: ollydbg on September 16, 2022, 07:50:24 am ---About the ccManagerMouseTrap220915-1.patch file.
I'm not sure, but this variable
--- Code: ---std::map<cbEditor*,bool> m_EdAutoCompMouseTraps;
--- End code ---
The bool value is always "true"? Since I see the only code here is:
--- Code: ---m_EdAutoCompMouseTraps[ed] = true;
--- End code ---
Also, is the code Windows related? If yes, I think the "#ifdef __WXMSW__" should also be placed in the header file around this member variable declaration.
--- End quote ---
The declaration and all references to m_EdAutoCompMouseTraps are already guarded by "#ifdef __WXMSW__"
--- Code: ---#ifdef __WXMSW__
/** a handle to the autocomplete list window created by (wx)scintilla, needed under Windows
* to determine its dimensions (so the scroll event can be sent to it, if relevant)
*/
wxListView* m_pAutocompPopup;
/**
* List of editors holding an event connect to popup mouse scroll event
* for AutoCompPopup and html Documentation popup
*/
std::map<cbEditor*,bool> m_EdAutoCompMouseTraps;
#endif // __WXMSW__
--- End code ---
The statement:
--- Code: ---m_EdAutoCompMouseTraps[ed] = true;
--- End code ---
is only used to enter the cbEditor* into the map assuring only one entry for this editor exists. Is there a better method for inserting a entry into a map?
It is removed by statement:
--- Code: ---m_EdAutoCompMouseTraps.erase(m_pLastEditor);
--- End code ---
I will make a specific comment explaining that.
Thanks for reviewing.
ollydbg:
I'm tweaking wx sample workspace, see here: codeblocks cbp projects for wx samples
While, after switch from one cbp to other cbp for many times, I got many clangd.exe process running, see the image shot below, is it correct?
Thanks.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version