Exception during System::destroy prevents proper cleanup of cegui

Create issue
Issue #423 resolved
Former user created an issue

Automatic migration. Original reporter: "fedyakin"

1) System::destroy() locks the window manager to prevent creation of windows during destruction. 2) System::destroy() then has the window manager delete all windows. 3) The window manager starts iterating its list of windows and eventually destroys the default tooltip. 4) The window manager then attempts to delete the next window after the default tooltip. 5) In Window::destroy the window attempts to retrieve the tooltip window. 5) System::getDefaultTooltip then attempts to create a new tooltip. 6) WindowManager::createWindow throws an exception because the window is locked.

CEGUI is now in an inconsistent state because parts of it have been destroyed properly, and other parts will not be properly destroyed.

Reproducibility: always

Additional information: I modified getDefaultTooltip locally so that it doesn't create the tooltip if the window manager is currently locked. This fixed the problem, but I'm not sure if thats the best way to fix the problem.

"Fixed" version Tooltip* System::getDefaultTooltip(void) const { if (!WindowManager::getSingleton().isLocked() && (!d_defaultTooltip && !d_defaultTooltipType.empty())) createSystemOwnedDefaultTooltipWindow();

return d_defaultTooltip; }

Comments (2)

  1. Paul Turner

    I couldn't reproduce this immediately - I guess it depends on the order of things and such. However, reading the code, I agree it's incorrect. I think the suggested fix is pretty much the right thing to do.

    Thanks.

  2. Log in to comment