BUG in ~ModalComponentManager() ! (and possible fix)

When the program is closed from outside (regardless as application or plugin) the current modal stack is deleted, but not its containing components which are marked as “autoDelete”, especially problematic with currently active AltertWindow::showMessageBoxAsync. The result is, non deleted windows which are attached to the desktop before the app is finished.

Here is the fix @ed95 @reuk

ModalComponentManager::~ModalComponentManager()
{
   // add from here
   for (int i = stack.size(); --i >= 0;)
   {
       auto* item = stack.getUnchecked(i);
       std::unique_ptr<ModalItem> deleter(stack.removeAndReturn(i));
       Component::SafePointer<Component> compToDelete(item->autoDelete ? item->component : nullptr);
       compToDelete.deleteAndZero();
   }
   // until here

   stack.clear();
   clearSingletonInstance();
}

Thanks for the report, there’s a fix for this on develop:

1 Like