Page 1 of 1

cl might crash because at a empty pointer.

Posted: Fri Oct 13, 2023 10:26 am
by kipade

At the constructor function of clEditor, at line 500, the code:

Code: Select all

SetSyntaxHighlight();

the calling stack looks like:

Code: Select all

ContextCpp::DoUpdateCalltipHighlight() : LiteEditor/context_cpp.cpp:2248
ContextCpp::OnSciUpdateUI(wxStyledTextEvent&) : context_cpp.cpp:1297
ContextCpp::SetActive() (this=0x555557ade700) : context_cpp.cpp:1281

and the final code here:

Code: Select all

///context_cpp.cpp:
void ContextCpp::DoUpdateCalltipHighlight()
{
    CHECK_JS_RETURN_VOID();
    clEditor& ctrl = GetCtrl();
    if(ctrl.GetFunctionTip()->IsActive()) { //line 2248
        ctrl.GetFunctionTip()->Highlight(DoGetCalltipParamterIndex());
    }
}

at the line 2247, ctrl would reference to the clEditor being construct itself, and at line 2248, it call GetFuntionTip to retrieve member point m_functionTip, but m_functionTip would be constructed later at line 516 of cl_editor.cpp. So, the application would crash because calling geter function from a null object.
And, I use the latest version from github. Thanks


Re: cl might crash because at a empty pointer.

Posted: Fri Oct 13, 2023 11:18 am
by eranif

fixed


Re: cl might crash because at a empty pointer.

Posted: Fri Oct 13, 2023 11:22 am
by kipade

Oh, I just found my code really older than the github, I just work on an older repo. Thanks.