Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Development => Topic started by: BlueHazzard on May 19, 2021, 01:04:03 am

Title: Configuration Manager is initialized before personality is set
Post by: BlueHazzard on May 19, 2021, 01:04:03 am
Reported by eckard_klotz here: https://forums.codeblocks.org/index.php/topic,24487.15.html the ask personality dialog is no longer working. It is always loaded the "default" personality.

to reproduce this:
1) copy the "default.conf" and rename it to "second_conf.conf"
2) start codeblocks with --personality=ask
3) select  "second_conf.conf"
4) Codeblocks will load "default.conf", you can confirm this in the first line in the code:blocks log tab

I tracked the problem to the PlaceWindow(&dlg) call in SetupPersonality
Code
void CodeBlocksApp::SetupPersonality(const wxString& personality)
{
    if (personality.CmpNoCase(_T("ask")) == 0)
    {
        const wxArrayString items(Manager::Get()->GetPersonalityManager()->GetPersonalitiesList());

        wxSingleChoiceDialog dlg(nullptr, _("Please choose which personality (profile) to load:"),
                                          _("Personalities (profiles)"),
                                          items);
        PlaceWindow(&dlg);
        if (dlg.ShowModal() == wxID_OK)
            Manager::Get()->GetPersonalityManager()->SetPersonality(dlg.GetStringSelection());
    }
    else
        Manager::Get()->GetPersonalityManager()->SetPersonality(personality, true);
}

in this call the configuration manager is initialized before the personality is set, so this leads to the config manager initializing always to default (GetPersonality() returns "default" if no personality is set)
Code
#0 ??	PersonalityManager::GetPersonality (this=0x4241f70) (\codeblocks_svn\src\sdk\personalitymanager.cpp:38)
#1 0x709a7e92 CfgMgrBldr::CfgMgrBldr(this=0x426bd10) (\codeblocks_svn\src\sdk\configmanager.cpp:183)
#2 0x70c6e1c5 Mgr<CfgMgrBldr>::Get() (include/manager.h:225)
#3 0x709aa073 CfgMgrBldr::GetConfigManager(name_space=...) (\codeblocks_svn\src\sdk\configmanager.cpp:431)
#4 0x70a0b7a6 Manager::GetConfigManager(this=0x4265a30, name_space=...) (\codeblocks_svn\src\sdk\manager.cpp:493)
#5 0x709f5053 PlaceWindow(w=0x1dae440, mode=pdlBest, enforce=false) (\codeblocks_svn\src\sdk\globals.cpp:1368)
#6 0x4084f3 CodeBlocksApp::SetupPersonality(this=0x1e6c8e0, personality=...) (\codeblocks_svn\src\src\app.cpp:1260)
#7 0x407a37 CodeBlocksApp::ParseCmdLine(this=0x1e6c8e0, handlerFrame=0x0, CmdLineString=..., CWD=...) (\codeblocks_svn\src\src\app.cpp:1218)
#8 0x403c52 CodeBlocksApp::OnInit(this=0x1e6c8e0) (\codeblocks_svn\src\src\app.cpp:647)
#9 0x4fa202 wxAppConsoleBase::CallOnInit(this=0x1e6c8e0) (wxWidgets-3.1.4/include/wx/app.h:93)
#10 0x64c73da2 wxEntryReal(int&, wchar_t**) () (\codeblocks_svn\src\devel31_64\wxmsw314u_gcc_custom.dll:??)
#11 0x4027cb WinMain(hInstance=0x400000, hPrevInstance=0x0, nCmdShow=10) (\codeblocks_svn\src\src\app.cpp:349)
#12 0x4dec6a main () (??:??)

i think we should simply remove the  PlaceWindow(&dlg) call here...
Any suggestions?

[edit:] Ticket, or else this will get lost https://sourceforge.net/p/codeblocks/tickets/1101/
Title: Re: Configuration Manager is initialized before personality is set
Post by: oBFusCATed on May 19, 2021, 09:29:38 am
Any suggestions?
Posting on 3 different places is hard to follow...
Otherwise, I'll handle it, soon...
Title: Re: Configuration Manager is initialized before personality is set
Post by: eckard_klotz on May 19, 2021, 02:17:01 pm
Hello BlueHazzard and oBFusCATed.

Please excuse that I post this answer more than once. But I'm unsure what discussion you prefer.

Quote
I think i can reproduce your error. But i think what is actually happening (and i can not understand why it only happens now): The ask dialog of the personality is not working...

That sounds good. What ever the reason is, if you could reproduce the result it should be possible to find the reason.


Quote
if i use the flag --personality="MinGW_9_2_0bit_TDM" everything works

can you confirm this?

Yes I can confirm.

Please stay well and healthy,
                                          Eckard Klotz.
Title: Re: Configuration Manager is initialized before personality is set
Post by: eckard_klotz on May 28, 2021, 10:51:42 am
Dear Developers.

Today I have downloaded the 24 May 2021 build (12452) from https://forums.codeblocks.org/index.php/topic,24510.0.html (https://forums.codeblocks.org/index.php/topic,24510.0.html).
I can confirm that the issue reported by me regarding the --personality="ask" is not occurring with the new build.

Thanks for your effort to solve it.

Please stay well and healthy,
                                         Eckard Klotz.