Page 1 of 1

CodeList crash when code completion is working

Posted: Tue Aug 30, 2016 11:34 am
by Peter.Jiang
Win32 MingW32 CodeLite9.1.2
1. Open CodeLite, create any project;
2. editor the project, input something like #incoude <std
3. then the wxCodeCompletionBox comes out
4. keep this wxCodeCompletionBox showing, and just select other program(process) in windows, say, Chrome
5. turn back to the CodeLite, it crash

///////////the crash call stack////////////////////////
0 0xfeeefeee ??
1 0x078eb1fe wxWindow::MSWWindowProc E:\\work\\CodeLite\\wxWidgets-3.0.2-Debug\\src\\msw\\window.cpp 3651
2 0x078e90e0 wxWndProc E:\\work\\CodeLite\\wxWidgets-3.0.2-Debug\\src\\msw\\window.cpp 2711
3 0x764886ef USER32!IsThreadDesktopComposited
4 0x001e120c ??
5 0x0000001c ??
6 0x00000000 ??

Re: CodeList crash when code completion is working

Posted: Tue Aug 30, 2016 11:42 am
by Peter.Jiang
if anyone knows any info about this problem, it will be very welcome to contact me by comment on this page or send me an email with address : long_jiang@c-sky.com

Re: CodeList crash when code completion is working

Posted: Tue Aug 30, 2016 12:41 pm
by eranif
Its a bug in wxWidgets.
Just build CodeLite in release mode (mainly: build wxWidgets in Release mode)

Eran

Re: CodeList crash when code completion is working

Posted: Wed Aug 31, 2016 5:47 pm
by Peter.Jiang
Hi, Eran
I just change a little in our CodeLite's source code, in wxCodeCompletionBoxManager#DestroyCCBox():
////////////////////////////////////////////////////////////////
if(m_box) {
if(m_box->IsShown()) {
m_box->Hide();
}
m_box->Destroy(); // /////----> change this to " m_box->Close() "
}
m_box = NULL;
m_stc = NULL;
////////////////////////////////////////////////////////////////
This crash disappear, I have no idea about the effect by this change.
What do you think about this "patch" ?

Re: CodeList crash when code completion is working

Posted: Thu Sep 01, 2016 12:55 pm
by eranif
Does it create a memory leak?
I am not sure if "Close" calls "Destroy" eventually...

Eran

Re: CodeList crash when code completion is working

Posted: Fri Sep 09, 2016 9:45 am
by Peter.Jiang
Hi, Eranif
I debugged this Close interface, it seems not do the real destroy work, thus, Close may cause memory leak.
I found another way to fix this problem:
in CodeLite's source code wxCodeCompletionBoxManager.cpp
///////////////////begin////////////////////////////////////////////
void wxCodeCompletionBoxManager::OnAppActivate(wxActivateEvent& event)
{
event.Skip();
DestroyCCBox(); // --> change this line into "CallAfter(&wxCodeCompletionBox::DoDestroy);"
}
///////////////////end/////////////////////////////////////////////
then, the crash disappear, and seems it will do the real destroy work;
how about this updating for the "patch" ?
Peter.Jiang

Re: CodeList crash when code completion is working

Posted: Fri Sep 09, 2016 10:01 am
by eranif
Looks good to me.
Committed