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

fatal error on exit

Started by codex, January 06, 2019, 05:09:13 PM

Previous topic - Next topic

codex

Sometimes, when I close code::blocks 17.12, a fatal assertion error pop up.
How can I fix this?

oBFusCATed

You have to try to narrow down the problem.
As a first step it is best if you can make it reproduce every time.

Also when reporting a problem is a good idea to specify the OS you're running. I can see that it is some kind of windows, but I cannot guess it.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

codex

#2
I'm currently running Windows 10 1809 x64, it usually happens when you close it using the taskbar.

EDIT:
Steps to reproduce the error:
1.Open some project
2.Close it with taskbar (right click and choose 'close this window')
It happens every time, I have it installed on another machine and raises same exception.

oBFusCATed

What plugins do you have enabled? Does it happen with a simple console project? Does it happen if you reset all your settings by renaming default.conf file?
Does it happen with a night build (do not use the last two versions, they are known to be buggy)?

Are you prepared to compile cb yourself and try to use a debugger to find out where the problem happens?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

codex

This is a fresh installation of codeblocks-17.12mingw-setup and you can also have no projects open, just tested this.
And I don't know the process of compiling code::blocks myself.

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

#6
Confirmed.

Windows 10/ CB rev 11540

#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 ?? () (??:??)


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;


        // 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)


Pecan