#106200IconFactory returns modified icons
Description
I as an API user would expect a proper Icon instance from the IconFactory.
But the IconFactory does not return the pure icon. It keeps an internal cache with references. The returned icons can be modified later through their setter. This might be useful if one would add an title or re use an icon but make it spinning.
The issue is that those are setters. Instead, a clone should be returned. Maybe `with` instead of `set` methods should exist.
This can also happen when using <core:icon title="Open actions menu" identifier="actions-menu" />. That way also integrators might run into those issues. As it is not clear that the `title` attribute will modify the system state of the used icon.
Steps to reproduce:
- Fetch an icon by its identifier in context a and render it
- Fetch an icon by the same identifier as in step 1, modify the returned icon, e.g. make it spinning or set a title and render it
- Fetch an icon by the same identifier as in step 1. It will be rendered with modifications from 2nd step.
The issue occurs in v12 and v13.
Reviews 0
No change resolves or names this issue in its commit message, and no comment links one.
Fix this issue
Start the commit message of your patch with this. Add what the patch does, and the versions it goes to in "Releases:". How to create a patch
- Commit message
-
[BUGFIX] IconFactory returns modified icons Resolves: #106200 Releases: main