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

Destructor problem with cbEditor

Started by 280Z28, January 10, 2006, 12:06:33 AM

Previous topic - Next topic

280Z28

I connected to an event like this:

void AutoStyle::OnEditorOpened(CodeBlocksEvent& event)
{
    if ( !m_IsAttached )
    {
        event.Skip();
        return;
    }
    cbEditor* ed = EDMAN()->GetBuiltinEditor( event.GetEditor() );
    if ( ed )
    {
        ed->Connect( wxEVT_SCI_CHARADDED,
                      (wxObjectEventFunction) (wxEventFunction) (wxScintillaEventFunction)
                      &AutoStyle::OnEditorCharAdded );
    }
    event.Skip();
}


In AutoStyle::OnEditorCharAdded, I have the following two lines:

                wxString previous = ed->GetControl()->GetLine(currLine-1);
                wxString newtext = cmt_formatter->ProcessNewLine(previous);


While running in the debugger, when I "step into" ProcessNewLine(), it takes me to ~cbEditor(), destroys the editor, and segfaults  :shock:

Here is the declaration for it:
wxString AsCommentsFormatter::ProcessNewLine(const wxString& previous) const

If I replace the second line with this, it works, but I need to modify the line:

                wxString newtext = previous;
78 280Z, "a few bolt-ons" - 12.71@109.04
99 Trans Am, "Daily Driver" - 525rwhp/475rwtq
Check out The Sam Zone :cool: