1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-24 08:32:34 +02:00

Fix possible assertion failure on resolution change

This commit is contained in:
Ivan Savenko 2023-08-02 21:23:27 +03:00
parent 72fcfbefdf
commit 3f7e5fcfc3

View File

@ -822,6 +822,15 @@ void AdventureMapInterface::hotkeyZoom(int delta)
void AdventureMapInterface::onScreenResize()
{
OBJ_CONSTRUCTION_CAPTURING_ALL_NO_DISPOSE;
// remember our activation state and reactive after reconstruction
// since othervice activate() calls for created elements will bypass virtual dispatch
// and will call directly CIntObject::activate() instead of dispatching virtual function call
bool widgetActive = isActive();
if (widgetActive)
deactivate();
widget.reset();
pos.x = pos.y = 0;
pos.w = GH.screenDimensions().x;
@ -838,4 +847,7 @@ void AdventureMapInterface::onScreenResize()
widget->getMapView()->onCenteredObject(LOCPLINT->localState->getCurrentArmy());
adjustActiveness();
if (widgetActive)
activate();
}