cl might crash because at a empty pointer.

Discussion about CodeLite development process and patches
kipade
CodeLite Enthusiast
Posts: 10
Joined: Thu Nov 01, 2012 11:14 am
Genuine User: Yes
IDE Question: C++
Contact:

cl might crash because at a empty pointer.

Post 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

User avatar
eranif
CodeLite Plugin
Posts: 6372
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: cl might crash because at a empty pointer.

Post by eranif »

fixed

Make sure you have read the HOW TO POST thread
kipade
CodeLite Enthusiast
Posts: 10
Joined: Thu Nov 01, 2012 11:14 am
Genuine User: Yes
IDE Question: C++
Contact:

Re: cl might crash because at a empty pointer.

Post by kipade »

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

Post Reply