1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-08-13 19:54:17 +02:00

Merge pull request #2462 from IvanSavenko/fix_assertion_failure

(1.3.1) Fix assertion failure on screen resize
This commit is contained in:
Ivan Savenko
2023-08-05 23:50:27 +03:00
committed by GitHub

View File

@@ -822,6 +822,15 @@ void AdventureMapInterface::hotkeyZoom(int delta)
void AdventureMapInterface::onScreenResize() void AdventureMapInterface::onScreenResize()
{ {
OBJ_CONSTRUCTION_CAPTURING_ALL_NO_DISPOSE; 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(); widget.reset();
pos.x = pos.y = 0; pos.x = pos.y = 0;
pos.w = GH.screenDimensions().x; pos.w = GH.screenDimensions().x;
@@ -838,4 +847,7 @@ void AdventureMapInterface::onScreenResize()
widget->getMapView()->onCenteredObject(LOCPLINT->localState->getCurrentArmy()); widget->getMapView()->onCenteredObject(LOCPLINT->localState->getCurrentArmy());
adjustActiveness(); adjustActiveness();
if (widgetActive)
activate();
} }