Ver código fonte

Merge pull request #2462 from IvanSavenko/fix_assertion_failure

(1.3.1) Fix assertion failure on screen resize
Ivan Savenko 2 anos atrás
pai
commit
b9e804954d
1 arquivos alterados com 12 adições e 0 exclusões
  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();
 }