User forums > General (but related to Code::Blocks)

Auto brackets for built in function is not working in cpp

<< < (3/3)

huycan:
Any updating on this bug.... (happens in Windows only)...

ollydbg:
I debugged this issue for a while, in the latest svn code.

In the function, in my condition m_CCAutoAddParentheses is true.


--- Code: ---void CodeCompletion::DoAutocomplete(const CCToken& token, cbEditor* ed)
{
    wxString itemText = CodeCompletionHelper::AutocompGetName(token.displayName);
    cbStyledTextCtrl* stc = ed->GetControl();
...
...
    if (token.id != -1 && m_CCAutoAddParentheses)
    {
        CC_LOCKER_TRACK_TT_MTX_LOCK(s_TokenTreeMutex)

        TokenTree* tree = m_NativeParser.GetParser().GetTokenTree();
        const Token* tkn = tree->at(token.id);
...


--- End code ---

I see that the token.id is always -1, this is the call stack:


--- Code: ---#0  CodeCompletion::DoAutocomplete (this=0x5c38db8, token=..., ed=0xd09d5a8) at D:\code\cb\cb_sf_git\cccrash2019\src\plugins\codecompletion\codecompletion.cpp:1335
#1  0x694a5ac9 in cbCodeCompletionPlugin::DoAutocomplete (this=0x5c38db8, token=L"gggggccccc(): int", ed=0xd09d5a8) at D:\code\cb\cb_sf_git\cccrash2019\src\sdk\cbplugin.cpp:1028
#2  0x694bbedd in CCManager::OnEditorHook (this=0xd069478, ed=0xd09d5a8, event=...) at D:\code\cb\cb_sf_git\cccrash2019\src\sdk\ccmanager.cpp:885
#3  0x69797921 in EditorHooks::HookFunctor<CCManager>::Call (this=0xcd3ebd0, editor=0xd09d5a8, event=...) at D:\code\cb\cb_sf_git\cccrash2019\src\include\editor_hooks.h:61
#4  0x694f3b73 in EditorHooks::CallHooks (editor=0xd09d5a8, event=...) at D:\code\cb\cb_sf_git\cccrash2019\src\sdk\editor_hooks.cpp:122
...


--- End code ---

I see that in the


--- Code: ---void cbCodeCompletionPlugin::DoAutocomplete(const wxString& token, cbEditor* ed)
{
    DoAutocomplete(CCToken(-1, token), ed);
}

--- End code ---

You see, the first argument of the CCToken constructor is -1, and this is actually the token.id.

I'm not sure why.

Miguel Gimenez:
There is a ticket about this issue, see https://sourceforge.net/p/codeblocks/tickets/1001/

There is also a related thread discussing scope of the bug, see http://forums.codeblocks.org/index.php/topic,24119.0.html . Looks like it stopped working when poup code for MSW was changed just before wx3.1.2 release.

ollydbg:

--- Quote from: Miguel Gimenez on September 11, 2020, 02:56:53 pm ---There is a ticket about this issue, see https://sourceforge.net/p/codeblocks/tickets/1001/

There is also a related thread discussing scope of the bug, see http://forums.codeblocks.org/index.php/topic,24119.0.html . Looks like it stopped working when poup code for MSW was changed just before wx3.1.2 release.

--- End quote ---
Thanks. There are some discussion in those links.

It looks like some issue happens in the wx related code, especially the mechanism to trigger the code completion event inside C::B's SDK.

Navigation

[0] Message Index

[*] Previous page

Go to full version