Ask a very puzzle problem abuot Codelite CodeCompletionBox..

CodeLite installation/troubleshooting forum
shushengyu
CodeLite Curious
Posts: 6
Joined: Sat Dec 07, 2013 9:35 am
Genuine User: Yes
IDE Question: zng
Contact:

Ask a very puzzle problem abuot Codelite CodeCompletionBox..

Post by shushengyu »

I am using CodeLite to gain a IDE for a language that I designed.
So first, I want to express my great thanks to you.
I am using vc10 to utilize the code of CodeLite, Does it have violated the licence? In the time, the project is nothing with commercial,
if someday I gained profit from it, I of course would like to donate to Codelite.
My question is that:
In plugin Abbreviation activated the function AbbreviationPlugin::OnAbbreviations , at where exeute

Code: Select all

 editor->ShowCompletionBox(tags, editor->GetWordAtCaret(), false, this);
then exeute

Code: Select all

CodeCompletionBox::Display
,in there then execute

Code: Select all

 m_ccBox->Show(tags, word, isKeywordList, owner);
and then exectue

Code: Select all

void CCBox::Show(const wxString& word)
and in the function end execute

Code: Select all

  Display(m_editor);
.
Now a puzzle problem is up:
In the void CCBox::Display(LEditor *editor), the function at last will call

Code: Select all

wxPopupWindow::Show(true)
,but
this will result in

Code: Select all

 void clMainFrame::OnAppActivated(wxActivateEvent &e)
is called, and then

Code: Select all

editor->HideCompletionBox();
is called , really is

Code: Select all

 CodeCompletionBox::Get().Hide(); 
.
So in the time

Code: Select all

m_ccBox->Destroy(); 
, but this result in m_ccBox->Destroy();,
The procedure lead to the

Code: Select all

void CCBox::Show(const wxString& word)
return from call

Code: Select all

 Display(m_editor);
with the program crashed!
Because the m_ccBox itself have been destroyed and deleted!
Of courese the official version is good , but what is the fact that I encounterd.
Can you give me some help?
Thanks a lot!
User avatar
eranif
CodeLite Plugin
Posts: 6372
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Ask a very puzzle problem abuot Codelite CodeCompletionB

Post by eranif »

Does this happens when you debug?
IN general, there is a problem when debugging the code completion box because the completion box terminates prematurely (because the debugger activated the app which deletes the completion box)

Did you try running it without a debugger?

Eran
Make sure you have read the HOW TO POST thread
shushengyu
CodeLite Curious
Posts: 6
Joined: Sat Dec 07, 2013 9:35 am
Genuine User: Yes
IDE Question: zng
Contact:

Re: Ask a very puzzle problem abuot Codelite CodeCompletionB

Post by shushengyu »

Oh,thansk.
When I am not in debugging, it will happen. And I discoved the procedure by debugging.
shushengyu
CodeLite Curious
Posts: 6
Joined: Sat Dec 07, 2013 9:35 am
Genuine User: Yes
IDE Question: zng
Contact:

Re: Ask a very puzzle problem abuot Codelite CodeCompletionB

Post by shushengyu »

shushengyu wrote:Oh,thansk.
When I am not in debugging, it will happen. And I discoved the procedure by debugging.
I am using wxWidget3.0, In

Code: Select all

bool wxPopupWindow::Show(bool show)
{
    if ( !wxWindowMSW::Show(show) )
        return false;

    if ( show )
    {
        // raise to top of z order
        if (!::SetWindowPos(GetHwnd(), HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE))
        {
            wxLogLastError(wxT("SetWindowPos"));
        }

        // and set it as the foreground window so the mouse can be captured
        ::SetForegroundWindow(GetHwnd());
    }

    return true;
}
"::SetForegroundWindow(GetHwnd());" is sure to result in
" clMainFrame::OnAppActivated"?
shushengyu
CodeLite Curious
Posts: 6
Joined: Sat Dec 07, 2013 9:35 am
Genuine User: Yes
IDE Question: zng
Contact:

Re: Ask a very puzzle problem abuot Codelite CodeCompletionB

Post by shushengyu »

eranif wrote:Does this happens when you debug?
IN general, there is a problem when debugging the code completion box because the completion box terminates prematurely (because the debugger activated the app which deletes the completion box)

Did you try running it without a debugger?

Eran
I have found in the following code, delete the last line, every thing is ok. what is the truth? :)

Code: Select all

void CCBox::OnItemActivated( wxListEvent& event )
{
    m_selectedItem = event.m_itemIndex;
    InsertSelection();
    HideCCBox();
}
User avatar
eranif
CodeLite Plugin
Posts: 6372
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Ask a very puzzle problem abuot Codelite CodeCompletionB

Post by eranif »

I will try this later on today - if it works, I can apply it in git head ( I wonder what it will break...)

Eran
Make sure you have read the HOW TO POST thread
shushengyu
CodeLite Curious
Posts: 6
Joined: Sat Dec 07, 2013 9:35 am
Genuine User: Yes
IDE Question: zng
Contact:

Re: Ask a very puzzle problem abuot Codelite CodeCompletionB

Post by shushengyu »

eranif wrote:I will try this later on today - if it works, I can apply it in git head ( I wonder what it will break...)

Eran
In my enviroment, It's seemed that the

Code: Select all

HideCCBox()
which lies in 'void CCBox::OnItemActivated', will cause the m_listCtrl recevied a message, but it's has been deleted .
Post Reply