Răsfoiți Sursa

Fix possible assertion failure on resolution change

Ivan Savenko 2 ani în urmă
părinte
comite
3f7e5fcfc3
1 a modificat fișierele cu 12 adăugiri și 0 ștergeri
  1. 12 0
      client/adventureMap/AdventureMapInterface.cpp

+ 12 - 0
client/adventureMap/AdventureMapInterface.cpp

@@ -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();
 }