Menu

#1101 Ask for personality Dialog loads always default configuration

Next_Nightly
fixed
Bug_Report
2021-05-28
2021-05-18
bluehazzard
No

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?

Forum thread: https://forums.codeblocks.org/index.php/topic,24502

Discussion

  • Miguel Gimenez

    Miguel Gimenez - 2021-05-19

    That call to PlaceWindow() was added in revision 12304, so it is compatible with the observations of eckard_klotz here (r12286 works, r12312 does not work).

     
  • Teodor Petrov

    Teodor Petrov - 2021-05-19

    Yes, I know I've added it. The question is how to prevent this happening in the future...

     
  • Teodor Petrov

    Teodor Petrov - 2021-05-19
    • assigned_to: bluehazzard --> Teodor Petrov
     
  • Eckard Klotz

    Eckard Klotz - 2021-05-19

    Dear All.

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

    BlueHazzard wrote in the Code::Blocks nightly-forum:

    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.

    BlueHazzard wrote in the Code::Blocks nightly-forum:

    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.

     
  • Teodor Petrov

    Teodor Petrov - 2021-05-22
    • status: open --> fixed
     
  • Teodor Petrov

    Teodor Petrov - 2021-05-22

    I've pushed a fix for this problem. Please test and report if there are any other regressions.

     
  • Miguel Gimenez

    Miguel Gimenez - 2021-05-22

    I get assertion failed at personalitymanager.cpp:37 (m_ready). I am not using personalities.

    Now I can't open C::B anymore

     
  • Miguel Gimenez

    Miguel Gimenez - 2021-05-23

    This is the stack trace:

    #0  PersonalityManager::GetPersonality (this=0x41c6cd0) at C:\Codeblocks\src\sdk\personalitymanager.cpp:37
    #1  0x00000000709a7a5b in CfgMgrBldr::CfgMgrBldr (this=0x41c8340) at C:\Codeblocks\src\sdk\configmanager.cpp:183
    #2  0x0000000070c67a25 in Mgr<CfgMgrBldr>::Get () at include/manager.h:225
    #3  0x00000000709a9c83 in CfgMgrBldr::GetConfigManager (name_space=...) at C:\Codeblocks\src\sdk\configmanager.cpp:431
    #4  0x0000000070a0b35e in Manager::GetConfigManager (this=0x41be490, name_space=...)
        at C:\Codeblocks\src\sdk\manager.cpp:493
    #5  0x000000000040268f in CodeBlocksApp::LoadConfig (this=0x3d5ba10) at C:\Codeblocks\src\src\app.cpp:395
    #6  0x0000000000403a62 in CodeBlocksApp::OnInit (this=0x3d5ba10) at C:\Codeblocks\src\src\app.cpp:654
    #7  0x00000000004f8912 in wxAppConsoleBase::CallOnInit (this=0x3d5ba10)
        at C:/Librerias/wxWidgets-3.1.5/include/wx/app.h:93
    #8  0x00000000628bec53 in wxEntryReal(int&, wchar_t**) () from C:\WINDOWS\SYSTEM32\wxmsw315u_gcc_custom.dll
    #9  0x000000000040255c in WinMain (hInstance=0x400000, hPrevInstance=0x0, lpCmdLine=0x1f93b0e "", nCmdShow=10)
        at C:\Codeblocks\src\src\app.cpp:349
    #10 0x00000000004013c7 in __tmainCRTStartup ()
    #11 0x00000000004014cb in WinMainCRTStartup ()
    
     
  • Teodor Petrov

    Teodor Petrov - 2021-05-23

    I know what it is... I'll fix in a minute...

     
  • Teodor Petrov

    Teodor Petrov - 2021-05-23

    Fixed [r12452]

     

    Related

    Commit: [r12452]

  • Eckard Klotz

    Eckard Klotz - 2021-05-28

    Dear Developers.

    Today I have downloaded the 24 May 2021 build (12452)
    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.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.