Developer forums (C::B DEVELOPMENT STRICTLY!) > Plugins development

ReopenEditor plugin issues

(1/1)

frithjofh:
Hi everybody,

encountered some problems with the ReopenEditor plugin. Found two issues:

Enabled it in plugins manager and it appeared in logs & others by default. After opening and closing files nothing appears in the output window of the plugin. Can anybody confirm this?

Choosing the option "Closed files list should be ... a dockable window" in the plugins settings dialog, c::b crashes immediately. Crash report attached. Can anybody confirm this?

My machine and setup: x86_64 Opensuse Linux. wxWidgets 3.0, c::b build from svn 11575.

Regards

frithjofh

Miguel Gimenez:
The crash is the same problem found in the ThreadSearch plugin (use after free), see ticket 777 and the forum

http://forums.codeblocks.org/index.php/topic,23061.0.html

In ReopenEditor::ShowList() the following line detachs and deletes m_pListLog:


--- Code: ---    CodeBlocksLogEvent evt1(cbEVT_REMOVE_LOG_WINDOW, m_pListLog);
    Manager::Get()->ProcessEvent(evt1);

--- End code ---

but inmediately after the code uses the deleted window again:


--- Code: ---    if(m_IsManaged)
    {
        CodeBlocksLogEvent evt3(cbEVT_ADD_LOG_WINDOW, m_pListLog, _("Closed files list"),
                                &m_LogIcon);
        Manager::Get()->ProcessEvent(evt3);
        CodeBlocksLogEvent evt4(cbEVT_SWITCH_TO_LOG_WINDOW, m_pListLog);
        Manager::Get()->ProcessEvent(evt4);
    }
    else
    {
        m_pListLog->Reparent(Manager::Get()->GetAppFrame());
        m_pListLog->SetSize(wxSize(800,94));
        m_pListLog->SetInitialSize(wxSize(800,94));

        CodeBlocksDockEvent evt(cbEVT_ADD_DOCK_WINDOW);
        evt.name = _T("ReopenEditorListPane");
        evt.title = _("Closed file list");
        evt.pWindow = m_pListLog;
        evt.dockSide = CodeBlocksDockEvent::dsBottom;
        evt.shown = true;
        evt.hideable = true;
        evt.desiredSize.Set(800, 94);
        evt.floatingSize.Set(800, 94);
        evt.minimumSize.Set(350, 94);
        Manager::Get()->ProcessEvent(evt);
    }

--- End code ---

I created a patch for ThreadSearch that should work here.

EDIT: the closed file list works OK for me.

Miguel Gimenez:
This simple patch fixes the crash (needs also the patch in ticket 777).

Miguel Gimenez:
Created ticket 807

https://sourceforge.net/p/codeblocks/tickets/807

Navigation

[0] Message Index

Go to full version