Change custom toolbar icon c++

Hello everyone, I have an integration in Libre Office in C++ that creates a custom toolbar, created following the example from the official Libre Office Github. I needed to change the icons as the application loaded, I tried many different methods, but in the end I came to the editing configuration method (.xcu), my method for editing icons in the configuration looks like this:

void BaseDispatch::ChangeIcon(OUString addinPath, OUString oldIconName, OUString newIconName) {

    auto access = configuration::ReadWriteAccess::create(mxContext, OUString("*"));

    Any userDefImgAny;

    userDefImgAny = access->getByHierarchicalName(
            OUString("/org.openoffice.Office.Addons/AddonUI/Images/['vnd.demo.complextoolbarcontrols.") + oldIconName + "']/UserDefinedImages");

    Reference<XInterface> userDefImg = *(XInterface**)userDefImgAny.getValue();

    Reference<XPropertySet> userDefImgProperties(userDefImg, UNO_QUERY);

    userDefImgProperties->setPropertyValue("ImageSmallURL", Any(addinPath + OUString("/Icons/16x16/") + newIconName + OUString(".png")));
    userDefImgProperties->setPropertyValue("ImageBigURL", Any(addinPath + OUString("/Icons/26x26/") + newIconName + OUString(".png")));

    access->commitChanges();
}

this method is called when creating the BaseDispatch class (analogous to the class from [https://github.com/LibreOffice/core/blob/master/odk/examples/cpp/complextoolbarcontrols/MyProtocolHandler.h](complextoolbarcontrols sample))
however, when you open LibreOffice for the first time, text appears in place of the new icons. I checked with a debugger all the paths to the icons and the feasibility of the functions - everything is correct. I checked if the main configuration file (registrymodifications.xcu) is being changed - the paths to the new icons are there, and I feel that the changes are simply not being applied. I spent a lot of time looking for a solution, please help me! :slight_smile:

P.S. when you open Libre Office for the second time, new icons are displayed correctly.

<wild guess>
maybe just consistent with any extension install which requires a restart of LO ?
</wild guess>

I install the integration when LibreOffice is not running; when the application opens, I simply change the icons. I think changing icons should happen without restarting the application.