Developer forums (C::B DEVELOPMENT STRICTLY!) > Development

Query on fixing compiler rename bug(s)

(1/2) > >>

When I rename compiler in the SVN 12487 and by the looks earlier releases it will result in a compiler configuration that has at least a blank masterpath setting. This can be seen if you do the following:
1) Make a copy of the "GNU GCC Compiler"
2) Rename the "Copy of GNU GCC Compiler" to say "test"
3) Close the compiler dialog
4) Exit CB
5) Load CB.
6) Select ok on the auto detect dialog.
7) Open the compilers dialog
8) Select the "test"
9) Select the "Toolchain executables" tab and the path is blank!!!

I would like to fix this while making other changes in the compilerioptionsdlg.cpp file, but there may be a number of ways to fix this and as such I would like to find out if the following would be acceptable as a fix before I start making changes, but if it not okay please let me know another way that would be acceptable that I can look at to implement:
1) Keep the exiting new name request GUI
2) Use the existing copy functionality to make a copy with the new name with the GUI name request disabled
3) Delete the old compiler name using the existing delete functionality  with the delete configuration disabled

Step 6 for me doesn't happen on linux.
My version of C::B doesn't popup the auto-detect dialog and everything works as expected.
At least the compiler's installation directory is correct.

Have you debugged what is the actual problem?

I have not debugged the exact cause as to see where the problem is as I need to first go through the copy code to see what it is doing and then through the rename code to see what it is not doing or doing differently compared to the copy code in order to find the problem or process that is wrong.

I was able to reproduce the issue with the last nightly SVN 1247 on Linux Mint 20.2. Let me be a bit more explicit with the instructions as it is vital that you do make any changes that cause the dirty flag to be set or the auto-detect to be triggered:

* Select the "GNU GCC Compiler" in the compiler settings
* Click on the "Copy" button
* Click on the "Ok" button to add the new compiler
* Click on the "Ok" button for the check toolchain executables exclamation info dialog
* Click on the "Rename" button
* Change the name to "test"
* Click on the "Ok" button to save and close the rename dialog
* Click on the "Ok" button to close the compiler dialog
* Close CB via the [X] on the top right of the app
* Run CB again.
* Select ok on the auto detect dialog.   (BTW try to figure out why the auto-detection is being displayed with the info shown)
* Open the compilers dialog
* Select the "test"
* Select the "Toolchain executables" tab and the path is blank!!!
Attached is a an image showing the symptom of the problem with the current SVN 12487 and a local build with the ticket 1117 auto-detection dialog changes that show the real reason the auto-detection dialog is shown ("User-defined masterpath issue")

If you exit Cb before renaming the copied compiler then on next CB startup the compiler is configured as you would expect.

I have looked a the copy compiler code and compared it to the rename code and narrowed the problem down the the following code not being included in the rename code as the rename works correctly with the equivalent block of code added (I added a rename function on compilerfactory.cpp similar to the existing copy function):

--- Code: ---    Compiler::m_CompilerIDs.Remove(compiler->GetID());
    compiler->m_ID = newName;
--- End code ---

This code is required as the compiler->m_ID was not updated in the current rename source code, which caused the settings to be saved against the old compiler->m_ID "name". When CB is restarted the new name is used to generate a "new" compiler->m_ID, which is then used to load the settings from the default.conf file, but in the case I found there will be no entries and therefore the masterpath is blank (and so are all of the other settings BTW). Ouch!!!!

Looks like the rename is either not used or if it is used then other settings are updated that cause the compiler->m_ID to be updated and therefore the renamed compiler is correctly saved in the default.conf and on a restart the auto-detect is not shown.

Post a patch then...


[0] Message Index

[#] Next page

Go to full version