Why are created listeners for button deleted and created again during openning of LibreOffice?

I develop addon for LibreOffice with custom buttons. Buttons has listeners that are created by libreoffice code somehow with help our XDispatch object. I notised that then I open LibroOffice the following happends:

  1. All event listeners are created
  2. All event listeners are deleted and created again one after the other
    Why is such recreation happenning?

To answer such questions, almost always it’s necessary to debug. So - the person who is in the best position to answer this is yourself: if you build LibreOffice in debug mode, then you will be able to use debugger, put breakpoints, see call stacks, understand the flow - and maybe suggest improvements. :wink: