Skip to content

Commit

Permalink
Merge pull request TrenchBroom#4334 from TrenchBroom/4306
Browse files Browse the repository at this point in the history
4306: Don't crash trying to merge a group into an open group
  • Loading branch information
kduske authored Sep 17, 2023
2 parents b7de79d + 814a76d commit f7c04bb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
16 changes: 7 additions & 9 deletions common/src/View/MapViewBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1556,16 +1556,14 @@ Model::GroupNode* MapViewBase::findGroupToMergeGroupsInto(
const auto hits = pickResult().all(type(Model::nodeHitType()));
if (!hits.empty())
{
auto* mergeTarget = findOutermostClosedGroup(Model::hitToNode(hits.front()));

const auto canReparentAll = std::all_of(
selectedNodes.nodes().begin(), selectedNodes.nodes().end(), [&](const auto* node) {
return node == mergeTarget || canReparentNode(node, mergeTarget);
});

if (canReparentAll)
if (auto* mergeTarget = findOutermostClosedGroup(Model::hitToNode(hits.front())))
{
return mergeTarget;
if (kdl::all_of(selectedNodes.nodes(), [&](const auto* node) {
return node == mergeTarget || canReparentNode(node, mergeTarget);
}))
{
return mergeTarget;
}
}
}

Expand Down
3 changes: 2 additions & 1 deletion common/test/src/View/tst_CompilationRunner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,9 @@ TEST_CASE_METHOD(
CHECK(exec.ended == !treatNonZeroResultCodeAsError);
}

#if !defined(_WIN32) || defined(NDEBUG)
#if (defined(_WIN64) && defined(NDEBUG)) || !defined(_WIN32)
// std::abort pops up a dialog when run in debug mode on Windows
// the test is unreliable on Windows 32bit
TEST_CASE_METHOD(MapDocumentTest, "CompilationRunToolTaskRunner.toolAborts")
{
auto variables = EL::NullVariableStore{};
Expand Down

0 comments on commit f7c04bb

Please sign in to comment.