Dialog Load Error when adding controls at runtime

using Libre 6.4.4.2

I have 2 buttons on my calc sheet that open separate dialogs
the problem is if any of the dialogs add controls to it at runtime, like a textbox,
then the Dialog Loads fine and everything works as expected ,
but Basic Editor opens by itself when I close that Dialog.
and after this when i click the other button on the sheet , then the other Dialog doesnt load showing an error on ‘dialog.execute’
error description simply says ‘Execute’

there is no such strange thing happening if I dont add controls at runtime.
Im used to VBA and I need to do a lot of runtime stuff in my Tools
just started using Libre and it seems to have several such bugs.
any ideas on how to tackle this particular one ?

Here’s how im Loading the Dialogs
DialogLibraries.LoadLibrary(“MyLibrary”)
dial = CreateUnoDialog( DialogLibraries.MyLibrary.MyDialog )

Please upload your ODF type sample file with the embedded macro code.

i did some more digging into it and found the problem. it wasnt the adding controls at runtime but adding dynamic event listeners to it.
mouse listener etc. if i add them in design view then no problem but adding listeners in code causes tat edittor to open wen the dialog is closed.
the code runs the same as it should either way but the editor thing happens only if runtime listeners added…
i tested this commenting the listeners and uncommenting several times and tats how i ws convinced
obviously a bug
and i tried this on 2 systems
my laptop and my office desktop
same behaviour