News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

CodeSnippets save-dock-position issue and possible solution

Started by wxLearner, April 24, 2007, 10:16:52 AM

Previous topic - Next topic

wxLearner

Hello,
the the codesnippets' dock-position gets forgotten after shutting down Code::Blocks. A possible solution is to modify the OnRelease method from
Code (codesnippets.cpp, line 160) Select
void CodeSnippets::OnRelease(bool appShutDown)
// ----------------------------------------------------------------------------
{
    if (not GetSnippetsWindow()) return;

    // Don't close down if file checking is active
    while ( m_nOnActivateBusy )
    {   wxMilliSleep(10) ; wxYield();
    }

    CodeBlocksDockEvent evt(cbEVT_REMOVE_DOCK_WINDOW);
    evt.pWindow = GetSnippetsWindow();
    Manager::Get()->GetAppWindow()->ProcessEvent(evt);

    GetSnippetsWindow()->Destroy();
    SetSnippetsWindow(0);
}
to void CodeSnippets::OnRelease(bool appShutDown)
// ----------------------------------------------------------------------------
{
    if (not GetSnippetsWindow()) return;
   
    if(!appShutDown)//Don't remove the pane, if Code::Blocks shuts down
    {
        // Don't close down if file checking is active
        while ( m_nOnActivateBusy )
        {   wxMilliSleep(10) ; wxYield();
        }

        CodeBlocksDockEvent evt(cbEVT_REMOVE_DOCK_WINDOW);
        evt.pWindow = GetSnippetsWindow();
        Manager::Get()->GetAppWindow()->ProcessEvent(evt);

        GetSnippetsWindow()->Destroy();
        SetSnippetsWindow(0);
    }
}

I'm not familiar with wxAUI, so I don't know, if this will lead to a memory leak, but I don't think so, because a wxWidgets window normally deletes it's child controls/windows automatically while being destroyed, doesn't it?

Pecan