News:

When registered with our forums, feel free to send a "here I am" post here to differ human beings from SPAM bots.

Main Menu

new CC branch built failed

Started by ollydbg, July 08, 2009, 08:00:07 AM

Previous topic - Next topic

Biplab

Quote from: 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.

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.
Be a part of the solution, not a part of the problem.

Jenna

Just investigated a little deeper:

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

Biplab

Quote from: jens 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.

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.
Be a part of the solution, not a part of the problem.

Biplab

Quote from: jens 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).

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.
Be a part of the solution, not a part of the problem.

ollydbg

Quote from: Biplab on November 27, 2009, 04:42:30 PM
IMO, code in BrowseTracker plugin should be changed. OnIdle function will be called frequently resulting in flooding of such event.

Agreed :D

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
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Jenna

Quote from: ollydbg on November 27, 2009, 04:48:47 PM
Quote from: Biplab on November 27, 2009, 04:42:30 PM
IMO, code in BrowseTracker plugin should be changed. OnIdle function will be called frequently resulting in flooding of such event.

Agreed :D

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 :
if(Manager::Get()->GetEditorManager()->GetActiveEditor() != eb)
before
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.

ollydbg

Quote from: jens on November 27, 2009, 05:23:15 PM
To fix this issue and be able to still use BrowseTracker, you can add :
if(Manager::Get()->GetEditorManager()->GetActiveEditor() != eb)
before
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.


// ----------------------------------------------------------------------------
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);
        }
    }
}
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Pecan

#22
EDIT: BrowseTracker fixed svn 5944

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

thanks,
pecan