Need advice... Crash at ~G4MTRunManager()

Hello all!

I try to rebuild my G4 application as a multithread one. Originally it was compiled under Windows as a single-thread one and worked fine. Recently, I migrated to Ubuntu and try to change it to a multithreading application.

I did the required changes in the code to “G4MTRunManager”, “ConstructSDandField” etc…

Generally, it works but it crashed at exit at G4UIManager::GetCommansStack() with the message “Error: Index was outside the bounds of the array”

Did somebody experience this?

I am sorry… I have found a stupid bug. I just called the destructor of the UIManager at the end of my application.

main()
{

G4UImanager* UI = G4UImanager::GetUIpointer();

delete UI;
}