Menu

#1446 SymbolTree CRC32 differs with identical Tree

Undefined
open
nobody
None
Undefined
2024-01-15
2024-01-15
Tiger Beard
No

The SymbolTree updates more often than needed because the newly generated tree has a different CRC32 than the last tree, even when no syntactical change was done.

How to reproduce
* load C:B workspace 30 in debug mode
* Set a breakpoint in line 1105 and note CRC32 value in file trunk / src / plugins / codecompletion / classbrowserbuilderthread.cpp and continue

 void ClassBrowserBuilderThread::FillGUITree(bool top)
   ... 
   const uint32_t NewCrc32 = localTree->GetCrc32();         //   line 1105
  • add a space to the open file and save. The tree will be re-created.
  • verify at the breakpoint that he new CRC32 is different.

I had a look at the CRC32 algorithm which is rather small but recursive. Its comparing some strange stuff like colors, but nothing suggests that there is an error.
So when the CRC differs then the trees are not identical.

Why are the token trees after a space insertion not identical?

This causes a lot of tree unnecessary updates.

Discussion

  • Miguel Gimenez

    Miguel Gimenez - 2024-01-15

    If you activated one item in the tree then it will be in bold, that will make the CRC to differ. The other tree item attributes should not change. You can try ignoring the bold status in CRC calculation.

     
  • Tiger Beard

    Tiger Beard - 2024-01-15

    OK, that would require the new tree to also restore the bold status which I think it does not do.
    When you say bold, the GUI tree does not show anything bold but inverse for selected. I guess that is the same?

     
  • Miguel Gimenez

    Miguel Gimenez - 2024-01-15

    The parser sets the attributes (colour, boldness etc) of the tree items. You can ignore some attributes when calculating thr CRC, isolating which is creating the difference. I wrote this CRC code about three yeats ago, but I have forgotten the details.

     

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.