Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Development => CodeCompletion redesign => Topic started by: ollydbg on July 08, 2009, 08:00:07 am

Title: new CC branch built failed
Post by: ollydbg on July 08, 2009, 08:00:07 am
Hi all.
I check out the new CC branch, and build in by TDM-MinGW. But failed in compiling, here is the output:

Code
-------------- Build: Code-completion in Code::Blocks ---------------

[  9.1%] g++.exe -Wall -g -pipe -mthreads -fmessage-length=0 -fexceptions -Winvalid-pch -DHAVE_W32API_H -D__WXMSW__ -DWXUSINGDLL -DcbDEBUG -DCB_PRECOMP -DWX_PRECOMP -DwxUSE_UNICODE  -DBUILDING_PLUGIN    -Iinclude -ID:\wxWidgets-2.8.10\include -ID:\wxWidgets-2.8.10\lib\gcc_dll\mswu -Iinclude\wxscintilla\include -Iinclude\tinyxml  -c F:\newCC\src\plugins\codecompletion\classbrowserbuilderthread.cpp -o .objs\plugins\codecompletion\classbrowserbuilderthread.o
F:\newCC\src\plugins\codecompletion\classbrowserbuilderthread.cpp:202: error: prototype for 'void ClassBrowserBuilderThread::BuildTree()' does not match any in class 'ClassBrowserBuilderThread'
F:\newCC\src\plugins\codecompletion\classbrowserbuilderthread.h:121: error: candidate is: void ClassBrowserBuilderThread::BuildTree(bool)
F:\newCC\src\plugins\codecompletion\classbrowserbuilderthread.cpp:368: error: prototype for 'wxTreeItemId ClassBrowserBuilderThread::AddNodeIfNotThere(wxTreeCtrl*, wxTreeItemId, const wxString&, int, CBTreeData*, bool)' does not match any in class 'ClassBrowserBuilderThread'
F:\newCC\src\plugins\codecompletion\classbrowserbuilderthread.h:123: error: candidate is: wxTreeItemId ClassBrowserBuilderThread::AddNodeIfNotThere(wxTreeCtrl*, wxTreeItemId, const wxString&, int, CBTreeData*)
F:\newCC\src\plugins\codecompletion\classbrowserbuilderthread.cpp:433: error: prototype for 'bool ClassBrowserBuilderThread::AddChildrenOf(wxTreeCtrl*, wxTreeItemId, int, int)' does not match any in class 'ClassBrowserBuilderThread'
F:\newCC\src\plugins\codecompletion\classbrowserbuilderthread.h:124: error: candidate is: bool ClassBrowserBuilderThread::AddChildrenOf(wxTreeCtrl*, wxTreeItemId, int, int, bool, int)
F:\newCC\src\plugins\codecompletion\classbrowserbuilderthread.cpp: In member function 'bool ClassBrowserBuilderThread::AddAncestorsOf(wxTreeCtrl*, wxTreeItemId, int)':
F:\newCC\src\plugins\codecompletion\classbrowserbuilderthread.cpp:479: error: no matching function for call to 'ClassBrowserBuilderThread::AddNodes(wxTreeCtrl*&, wxTreeItemId&, std::_Rb_tree_const_iterator<int>, std::_Rb_tree_const_iterator<int>, int, bool)'
F:\newCC\src\plugins\codecompletion\classbrowserbuilderthread.h:127: note: candidates are: bool ClassBrowserBuilderThread::AddNodes(wxTreeCtrl*, wxTreeItemId, const TokenIdxSet&, int, int, bool, bool)
F:\newCC\src\plugins\codecompletion\classbrowserbuilderthread.cpp: In member function 'bool ClassBrowserBuilderThread::AddDescendantsOf(wxTreeCtrl*, wxTreeItemId, int, bool)':
F:\newCC\src\plugins\codecompletion\classbrowserbuilderthread.cpp:494: error: no matching function for call to 'ClassBrowserBuilderThread::AddNodes(wxTreeCtrl*&, wxTreeItemId&, std::_Rb_tree_const_iterator<int>, std::_Rb_tree_const_iterator<int>, int, bool)'
F:\newCC\src\plugins\codecompletion\classbrowserbuilderthread.h:127: note: candidates are: bool ClassBrowserBuilderThread::AddNodes(wxTreeCtrl*, wxTreeItemId, const TokenIdxSet&, int, int, bool, bool)
F:\newCC\src\plugins\codecompletion\classbrowserbuilderthread.cpp: At global scope:
F:\newCC\src\plugins\codecompletion\classbrowserbuilderthread.cpp:500: error: prototype for 'bool ClassBrowserBuilderThread::AddNodes(wxTreeCtrl*, wxTreeItemId, std::_Rb_tree_const_iterator<int>, std::_Rb_tree_const_iterator<int>, int, bool)' does not match any in class 'ClassBrowserBuilderThread'
F:\newCC\src\plugins\codecompletion\classbrowserbuilderthread.h:127: error: candidate is: bool ClassBrowserBuilderThread::AddNodes(wxTreeCtrl*, wxTreeItemId, const TokenIdxSet&, int, int, bool, bool)
F:\newCC\src\plugins\codecompletion\classbrowserbuilderthread.cpp:603: error: no 'void ClassBrowserBuilderThread::SelectNode(wxTreeItemId)' member function declared in class 'ClassBrowserBuilderThread'
F:\newCC\src\plugins\codecompletion\classbrowserbuilderthread.cpp:752: error: prototype for 'void ClassBrowserBuilderThread::CollapseItem(wxTreeItemId)' does not match any in class 'ClassBrowserBuilderThread'
F:\newCC\src\plugins\codecompletion\classbrowserbuilderthread.h:116: error: candidate is: void ClassBrowserBuilderThread::CollapseItem(wxTreeItemId, bool)
F:\newCC\src\plugins\codecompletion\classbrowserbuilderthread.cpp: In member function 'void ClassBrowserBuilderThread::SelectItem(wxTreeItemId)':
F:\newCC\src\plugins\codecompletion\classbrowserbuilderthread.cpp:773: error: 'SelectNode' was not declared in this scope
Process terminated with status 1 (0 minutes, 2 seconds)
14 errors, 0 warnings

Any ideas?

Thanks.
Title: Re: new CC branch built failed
Post by: GeO on July 08, 2009, 08:21:31 am
I get the same errors!
It seems like the source file (classbrowserbuilderthread.cpp) was patched,
but the header file (classbrowserbuilderthread.h) not.

Greets GeO
Title: Re: new CC branch built failed
Post by: MortenMacFly on July 08, 2009, 11:22:17 am
It seems like the source file (classbrowserbuilderthread.cpp) was patched,
but the header file (classbrowserbuilderthread.h) not.
It was the other way round but anyways... try again...
Title: Re: new CC branch built failed
Post by: GeO on July 08, 2009, 11:47:09 am
Thanks a lot Morten!!
Now everthing works fine!
Title: Re: new CC branch built failed
Post by: ollydbg on July 09, 2009, 08:35:38 am
@Morten

I found a bug in new CC branch

If a file is opened by context menu-> open #include file "XXXX.h", then the CodeBrowser tree of "XXXX.h" will not be updated.

Can someone confirm this bug?

Thanks.

Title: Re: new CC branch built failed
Post by: MortenMacFly on July 09, 2009, 11:47:53 am
If a file is opened by context menu-> open #include file "XXXX.h", then the CodeBrowser tree of "XXXX.h" will not be updated.
How was that in previous version(s)? Is that really in the new CC branch only?
BTW: There are some more (minor) glitches I found. I'll post them when I'm back from holiday... probably you've found yourself by then already... ;-)
Title: Re: new CC branch built failed
Post by: ollydbg on July 09, 2009, 02:54:24 pm
How was that in previous version(s)? Is that really in the new CC branch only?
Yes, at least this bug is not in official nightly build version. :D

BTW, Have a nice holiday!!!
Title: Re: new CC branch built failed
Post by: ollydbg on July 10, 2009, 08:42:54 am
The bug seems located in these code, I have debug CB in CB :D:

Code
void NativeParser::OnEditorActivated(EditorBase* editor)
{
    if (!m_pClassBrowser)
        return;
    cbEditor* ed = editor && editor->IsBuiltinEditor() ? static_cast<cbEditor*>(editor) : 0;
    if (ed)
    {
        Parser* parser = FindParserFromEditor(ed);
        if (parser && parser->ClassBrowserOptions().displayFilter == bdfFile)
        {
            m_pClassBrowser->UpdateView();
        }
    }
}

When I right click to open a  "#include XXXX.h" file, then CC will receive  an editor active command, then the code above will be called.

But I'm sure the ed == NULL. :D

So, that's the reason why m_pClassBrowser not updated.
Title: Re: new CC branch built failed
Post by: Jenna on July 10, 2009, 10:14:15 am
But I'm sure the ed == NULL. :D

So, that's the reason why m_pClassBrowser not updated.

Good catch, but this bug is a bug that slipped in with the use of wxAuiNotebook and not new CC.

It seems the editormanager gets the PageChanged event, before the editor is initialized.
In it's PageChanged event-handler it sends the cbEVT_EDITOR_ACTIVATED-event and therefore IsBuiltinEditor() returns false in this case.

I will look into it.
Title: Re: new CC branch built failed
Post by: ollydbg on October 30, 2009, 02:16:42 am
But I'm sure the ed == NULL. :D

So, that's the reason why m_pClassBrowser not updated.

Good catch, but this bug is a bug that slipped in with the use of wxAuiNotebook and not new CC.

It seems the editormanager gets the PageChanged event, before the editor is initialized.
In it's PageChanged event-handler it sends the cbEVT_EDITOR_ACTIVATED-event and therefore IsBuiltinEditor() returns false in this case.

I will look into it.


Just a remainder, this bug seems still exist by now. :D
Title: Re: new CC branch built failed
Post by: ollydbg on November 27, 2009, 09:53:12 am
Hi, jens, this problem is fixed in the SVN rev 5939 by biplab. When the cbEVT_EDITOR_ACTIVATED is send correctly.

Thanks to biplab!!!
Title: Re: rev 5942 CPU usage 50% when an editor is opened.
Post by: ollydbg on November 27, 2009, 03:18:45 pm
I just find a serious bug! SVN rev 5942

when any editor is opened, it seems the the CPU usage was 50%, and the title bar of Code::Blocks gets flashed continuously. :(

Does any one meet the same problem, it seems there is no problem before rev 5939.

Title: Re: new CC branch built failed
Post by: blueshake on November 27, 2009, 04:17:10 pm
@ollydbg
can not reproduce it.
Title: Re: new CC branch built failed
Post by: Jenna on November 27, 2009, 04:29:34 pm
I can confirm this (on linux).
I have a small plugin, that hooks into C::B event-sink to debug C::B's internal events, and we get flooded with cbEVT_EDITOR_ACTIVATED.
Removing Biplabs commit from svn r5939 fixed this issue.
Title: Re: new CC branch built failed
Post by: ollydbg on November 27, 2009, 04:30:52 pm
@ollydbg
can not reproduce it.

Strange, it seems the commit rev 5939 just add a cbEVT_EDITOR_ACTIVATED event. If this is not a bug, I think there are some plugins who cause the endless loop. :(
Title: Re: rev 5942 CPU usage 50% when an editor is opened.
Post by: Biplab on November 27, 2009, 04:37:07 pm
I just find a serious bug! SVN rev 5942

when any editor is opened, it seems the the CPU usage was 50%, and the title bar of Code::Blocks gets flashed continuously. :(

Does any one meet the same problem, it seems there is no problem before rev 5939.

I didn't notice any flashing. Tested on Linux. However I'll try to do more testing tomorrow to find any issues with it.


BTW, I didn't track this thread. Rev 5939 was necessary to fix another bug. In OpenFileList plugin, the open file tree shows wrong path of recently opened editor. The bug is noticeable when a file is opened by clicking on project tree. Sending cbEVT_EDITOR_ACTIVATED event fixed that.
Title: Re: new CC branch built failed
Post by: Jenna on November 27, 2009, 04:39:48 pm
Just investigated a little deeper:

the BrowseTracker-plugin calls SetActiveEditor in its OnIdle-function (and this one is called quiet often of course).
Title: Re: new CC branch built failed
Post by: Biplab on November 27, 2009, 04:40:41 pm
I can confirm this (on linux).
I have a small plugin, that hooks into C::B event-sink to debug C::B's internal events, and we get flooded with cbEVT_EDITOR_ACTIVATED.
Removing Biplabs commit from svn r5939 fixed this issue.

It was not sent before and thus it's usual that you get a number of such events after that change was made.

Nevertheless, I'll test it more tomorrow and revert the commit if that's necessary.
Title: Re: new CC branch built failed
Post by: Biplab on November 27, 2009, 04:42:30 pm
Just investigated a little deeper:

the BrowseTracker-plugin calls SetActiveEditor in its OnIdle-function (and this one is called quiet often of course).

Thanks for the quick update. IMO, code in BrowseTracker plugin should be changed. OnIdle function will be called frequently resulting in flooding of such event.
Title: Re: new CC branch built failed
Post by: ollydbg on November 27, 2009, 04:48:47 pm
IMO, code in BrowseTracker plugin should be changed. OnIdle function will be called frequently resulting in flooding of such event.

Agreed :D

Code
void BrowseTracker::OnIdle(wxIdleEvent& event)
// ----------------------------------------------------------------------------
{
     event.Skip();

    // Focus the new selected editor. This doesn't work if a long compile
    // is active since there's no idle time. User will have to click into
    // the editor window to activate it.
    // This used to be done by the CB editor manager, but someone removed the UI hook.
    if ((not Manager::Get()->IsAppShuttingDown()) && m_UpdateUIFocusEditor)
    {
        if (m_UpdateUIFocusEditor)
        {
            EditorBase* eb = m_UpdateUIFocusEditor;
            if (not eb) return;
            m_UpdateUIFocusEditor = 0;
            Manager::Get()->GetEditorManager()->SetActiveEditor(eb);
             eb->SetFocus();
            #if defined(LOGGING)
             LOGIT( _T("BT OnIdle Focused Editor[%p] Title[%s]"), eb, eb->GetTitle().c_str() );
            #endif
            // re-sort the browse marks
            wxCommandEvent ev;
            OnMenuSortBrowse_Marks(ev);
        }
    }
}

Note:

Quote
// This used to be done by the CB editor manager, but someone removed the UI hook.
:D
Title: Re: new CC branch built failed
Post by: Jenna on November 27, 2009, 05:23:15 pm
IMO, code in BrowseTracker plugin should be changed. OnIdle function will be called frequently resulting in flooding of such event.

Agreed :D

Code
void BrowseTracker::OnIdle(wxIdleEvent& event)
// ----------------------------------------------------------------------------
{
     event.Skip();

    // Focus the new selected editor. This doesn't work if a long compile
    // is active since there's no idle time. User will have to click into
    // the editor window to activate it.
    // This used to be done by the CB editor manager, but someone removed the UI hook.
    if ((not Manager::Get()->IsAppShuttingDown()) && m_UpdateUIFocusEditor)
    {
        if (m_UpdateUIFocusEditor)
        {
            EditorBase* eb = m_UpdateUIFocusEditor;
            if (not eb) return;
            m_UpdateUIFocusEditor = 0;
            Manager::Get()->GetEditorManager()->SetActiveEditor(eb);
             eb->SetFocus();
            #if defined(LOGGING)
             LOGIT( _T("BT OnIdle Focused Editor[%p] Title[%s]"), eb, eb->GetTitle().c_str() );
            #endif
            // re-sort the browse marks
            wxCommandEvent ev;
            OnMenuSortBrowse_Marks(ev);
        }
    }
}

Note:

Quote
// This used to be done by the CB editor manager, but someone removed the UI hook.
:D


To fix this issue and be able to still use BrowseTracker, you can add :
Code
if(Manager::Get()->GetEditorManager()->GetActiveEditor() != eb)
before
Code
Manager::Get()->GetEditorManager()->SetActiveEditor(eb);
in BrowseTracker's OnIdle.

It's maybe only a workaround and I think pecan should look into this code, whether it is still needed or not, so I do not commit it to trunk.
Title: Re: new CC branch built failed
Post by: ollydbg on November 28, 2009, 07:05:34 am
To fix this issue and be able to still use BrowseTracker, you can add :
Code
if(Manager::Get()->GetEditorManager()->GetActiveEditor() != eb)
before
Code
Manager::Get()->GetEditorManager()->SetActiveEditor(eb);
in BrowseTracker's OnIdle.

It's maybe only a workaround and I think pecan should look into this code, whether it is still needed or not, so I do not commit it to trunk.

Thanks jens!!! You are so smart!

Where is pecan? :D

Also, I just modify to this. (include " eb->SetFocus(); " to the if statement), also works.

Code
// ----------------------------------------------------------------------------
void BrowseTracker::OnIdle(wxIdleEvent& event)
// ----------------------------------------------------------------------------
{
     event.Skip();

    // Focus the new selected editor. This doesn't work if a long compile
    // is active since there's no idle time. User will have to click into
    // the editor window to activate it.
    // This used to be done by the CB editor manager, but someone removed the UI hook.
    if ((not Manager::Get()->IsAppShuttingDown()) && m_UpdateUIFocusEditor)
    {
        if (m_UpdateUIFocusEditor)
        {
            EditorBase* eb = m_UpdateUIFocusEditor;
            if (not eb) return;
            m_UpdateUIFocusEditor = 0;
            if(Manager::Get()->GetEditorManager()->GetActiveEditor() != eb)
            {
                Manager::Get()->GetEditorManager()->SetActiveEditor(eb);
                eb->SetFocus();
            }

            #if defined(LOGGING)
             LOGIT( _T("BT OnIdle Focused Editor[%p] Title[%s]"), eb, eb->GetTitle().c_str() );
            #endif
            // re-sort the browse marks
            wxCommandEvent ev;
            OnMenuSortBrowse_Marks(ev);
        }
    }
}
Title: Re: new CC branch built failed
Post by: Pecan on November 30, 2009, 03:37:00 pm
EDIT: BrowseTracker fixed svn 5944

Acknowledging this thread. I'll look into the situations.

thanks,
pecan