User forums > Help

fatal error on exit

<< < (2/2)

Krice:
Why can't you just close it? Why use task manager to end the program? I guess it wont even close proprerly that way, that's why you get the error.

Pecan:
Confirmed.

Windows 10/ CB rev 11540

--- Code: ---#0 ?? Mgr<EditorManager>::Get () (C:/Usr/Proj/cbBeta/trunk/src/include/manager.h:206)
#1 0x61891b42 Manager::GetEditorManager(this=0x24ace80) (C:\Usr\Proj\cbBeta\trunk\src\sdk\manager.cpp:436)
#2 0x40a27b CodeBlocksApp::OnAppActivate(this=0x24ad848, event=...) (C:\Usr\Proj\cbBeta\trunk\src\src\app.cpp:1450)
#3 0x1cc1262 wxAppConsole::HandleEvent(wxEvtHandler*, void (wxEvtHandler::*)(wxEvent&) (C:\Usr\Proj\wxWidgets2812\lib\gcc_dll\wxmsw28u_gcc_custom.dll:??)
#4 0x14af6dc ?? () (??:??)

--- End code ---

Source app.cpp is trying to get the editor manager.
There is a check for shutdown at the beginning of this function, but it obviously has not been set yet.
I don't see any way of knowing that this is entered for shutdown from the taskBar.

The error is caused by the consequences of this line:
        wxPostEvent(Manager::Get()->GetEditorManager(), evt);
which allows OnApplicationClose() to be invoked (thus freeing the Managers) before returning to OnApplicationActivated().

Changing the code to check for shutdown after the post seems to solve the problem:
        wxCommandEvent evt(wxEVT_COMMAND_MENU_SELECTED, idEditorManagerCheckFiles);
        wxPostEvent(Manager::Get()->GetEditorManager(), evt);
        if ( Manager::IsAppShuttingDown())
            return;


--- Code: ---        // for some reason a mouse up event doesn't make it into scintilla (scintilla bug)
        // therefore the workaround is not to directly call the editorManager, but
        // take a detour through an event
        // the bug is when the file has been offered to reload, no matter what answer you
        // give the mouse is in a selecting mode, adding/removing things to it's selection as you
        // move it around
        // so : idEditorManagerCheckFiles, EditorManager::OnCheckForModifiedFiles just exist for this workaround
        wxCommandEvent evt(wxEVT_COMMAND_MENU_SELECTED, idEditorManagerCheckFiles);
        wxPostEvent(Manager::Get()->GetEditorManager(), evt);
        cbProjectManagerUI *prjManUI = m_Frame->GetProjectManagerUI();
        if (prjManUI)
            static_cast<ProjectManagerUI*>(prjManUI)->CheckForExternallyModifiedProjects();
    }
    cbEditor* ed = Manager::Get()->GetEditorManager()
                 ? Manager::Get()->GetEditorManager()->GetBuiltinActiveEditor() : nullptr;
    if (ed)
    {
        // hack for linux: without it, the editor loses the caret every second activate o.O
        Manager::Get()->GetEditorManager()->GetNotebook()->SetFocus();
        ed->GetControl()->SetFocus();
    }
}

void CodeBlocksApp::AddFileToOpenDelayed(const wxString& filename)


--- End code ---

Pecan:
Fixed: At revision: 11561

Navigation

[0] Message Index

[*] Previous page

Go to full version