Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Plugins development => Topic started by: 280Z28 on January 09, 2006, 05:18:07 pm

Title: Crash in debugger plugin
Post by: 280Z28 on January 09, 2006, 05:18:07 pm
It seems it doesn't turn off it's message logging when the message manager closes, so it crashed in DebuggerGDB::Log(). It's hard for me to reproduce this bug (I'm guessing it's been there for a long time, but this is the first time I've seen it). This seems to be a solution, but maybe what really needs to be done is have the debugger stop making logging calls after the manager closes? Y'all would know better than me on this.

Code
void DebuggerGDB::Log(const wxString& msg)
{
    Manager* manager = Manager::Get();
    if (!manager)
        return;
    MessageManager* msgmanager = manager->GetMessageManager();
    if (!msgmanager)
        return;
    msgmanager->Log(m_PageIndex, msg);
}

void DebuggerGDB::DebugLog(const wxString& msg)
{
    // gdb debug messages
    if (m_HasDebugLog)
    {
        Manager* manager = Manager::Get();
        if (!manager)
            return;
        MessageManager* msgmanager = manager->GetMessageManager();
        if (!msgmanager)
            return;
        msgmanager->Log(m_DbgPageIndex, msg);
    }
}
Title: Re: Crash in debugger plugin
Post by: mandrav on January 09, 2006, 06:40:14 pm
Quote from: 280Z28
Y'all would know better than me on this.

Hehe, I just might :)

Code
void DebuggerGDB::Log(const wxString& msg)
{
    if (m_IsAttached)
        Manager::Get()->GetMessageManager()->Log(m_PageIndex, msg);
}

void DebuggerGDB::DebugLog(const wxString& msg)
{
    // gdb debug messages
    if (m_IsAttached && m_HasDebugLog)
        Manager::Get()->GetMessageManager()->Log(m_DbgPageIndex, msg);
}

Revision 1695.