Hotfix available: CodeSnip bug fix fix

It had to happen didn't it? Not long after my post about yesterday's bug fix release of CodeSnip, Oliver reached out to point out a potential problem with the way I'd implemented it. See the linked post and comments if you're interested in the details.

Suffice to say that the problem was sufficient for me to hunt for an alternative solution. Having found one I've rushed out hotfix v4.24.2 to patch yesterday's release (v4.24.1) and make it more robust.

Whether or not you downloaded yesterday's you really should update CodeSnip to the hotfix release.

⮞ Get hotfix release v4.24.2 from GitHub.

For more info please see the similar post on the CodeSnip Blog.



Comments

  1. The root cause of that bug is when a TreeView is recreated all Nodes save their state into a MemoryStream then they get destroyed and then recreated from that MemoryStream.

    My advice is to store the IView reference in the Data property of the TViewItemTreeNode Data := Pointer(Value); and back with Result := IView(Data);

    The management for the IView references goes to TOverviewFrame which keeps the references in a TList;

    TOverviewTreeBuilder will get a reference of that list and on Build it will clear the list and adds all IView references.

    I made a quick test on your source and it runs totally fine even after removing all of that hacking stuff ;o)

    Happy Easter

    ReplyDelete
    Replies
    1. Thanks for that Oliver. I was considering trying to use the Data property instead of the custom property in the derived custom tree node class.

      But I didn't consider casting the IView reference directly to Pointer, I thought I'd need to get at the underlying object through nefarious means! I guess that Pointer(IView) must use the pointer to the implementing object?

      I'll certainly try that. Many thanks. The reason I sub classed TTreeNode to add the IView property is because I don't like casting to Pointer, but it's certainly much cleaner code than the current fix!

      Given that the Easter bank holiday has brought its usual vile weather here in Wales, I don't want to be out and about, so should have some time to try this!

      Happy Easter to you too.

      Delete
    2. Just in case you missed it on GitHub, your patch has been rolled into release v4.25.0. Thx again.

      Delete

Post a Comment

Comments are very welcome, but please don't comment here if:

1) You have a query about, or a bug report for, one of my programs or libraries. Most of my posts contain a link to the relevant repository where there will be an issue tracker you can use.

2) You have a query about any 3rd party programs I feature, please address them to the developer(s) - there will be a link in the post.

3) You're one of the tiny, tiny minority who are aggressive or abusive - in the bin you go and reported you will be!

Thanks

Popular posts from this blog

Initialising dynamic arrays

Deleting elements from a dynamic array