GunChleoc has proposed merging lp:~widelands-dev/widelands/bug-1807156-heap-use-after-free into lp:widelands.
Commit message: Ensure that interactive base still exists when toggling building help window This will potentially fix a heap-use-after-free Requested reviews: Widelands Developers (widelands-dev) Related bugs: Bug #1807156 in widelands: "AddressSanitizer: heap-use-after-free" https://bugs.launchpad.net/widelands/+bug/1807156 For more details, see: https://code.launchpad.net/~widelands-dev/widelands/bug-1807156-heap-use-after-free/+merge/363584 I could not reproduce the original bug, so this fix is just my best guess. -- Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/bug-1807156-heap-use-after-free into lp:widelands.
=== modified file 'src/wui/buildingwindow.cc' --- src/wui/buildingwindow.cc 2019-02-23 11:00:49 +0000 +++ src/wui/buildingwindow.cc 2019-02-24 07:12:07 +0000 @@ -356,12 +356,14 @@ UI::UniqueWindow::Registry& registry = igbase()->unique_windows().get_registry(building_descr_for_help_.name() + "_help"); registry.open_window = [this, ®istry] { - Widelands::Building* building_in_lambda = building_.get(parent_->egbase()); - if (building_in_lambda == nullptr) { - return; + if (parent_ != nullptr) { + Widelands::Building* building_in_lambda = building_.get(parent_->egbase()); + if (building_in_lambda == nullptr) { + return; + } + new UI::BuildingHelpWindow(igbase(), registry, building_descr_for_help_, + building_in_lambda->owner().tribe(), &parent_->egbase().lua()); } - new UI::BuildingHelpWindow(igbase(), registry, building_descr_for_help_, - building_in_lambda->owner().tribe(), &parent_->egbase().lua()); }; helpbtn->sigclicked.connect(
_______________________________________________ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp