mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-25 14:40:26 -05:00
Address sanitizer detected a memory leak in QProxyStyle objects created during GUI theme updates. Problem: The updateGuiTheme() function was called multiple times (e.g., during initialization) and repeatedly created new PdmUiTreeViewStyle objects for every PdmUiTreeViewWidget without checking if the widget already had the correct style set. Root cause: Each call to updateGuiTheme() would: 1. Iterate through ALL widgets in the application 2. Create a new PdmUiTreeViewStyle for every tree view widget 3. Call setStyle() which should take ownership, but repeated calls were causing memory leaks Fix: Added a check to only create and set a new PdmUiTreeViewStyle if the widget doesn't already have one. This prevents repeatedly creating new styles for the same widgets during multiple theme update calls. The fix uses dynamic_cast to check if the current style is already a PdmUiTreeViewStyle before creating a new one.