Skip to content

Commit

Permalink
Fix EventsFunctionsContainer copy constructor now copy the owner (#7327)
Browse files Browse the repository at this point in the history
- Don't show in changelog
  • Loading branch information
D8H authored Jan 20, 2025
1 parent 60e36f3 commit 093e15e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 5 additions & 2 deletions Core/GDCore/Project/EventsFunctionsContainer.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,16 @@ class GD_CORE_API EventsFunctionsContainer

EventsFunctionsContainer(FunctionOwner source_) : owner(source_) {}

EventsFunctionsContainer(const EventsFunctionsContainer &other) {
EventsFunctionsContainer(const EventsFunctionsContainer &other)
: owner(other.owner) {
Init(other);
}

EventsFunctionsContainer &operator=(const EventsFunctionsContainer &other) {
if (this != &other)
if (this != &other) {
owner = other.owner;
Init(other);
}

return *this;
}
Expand Down
2 changes: 2 additions & 0 deletions Core/tests/EventsFunctionsContainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ TEST_CASE("EventsFunctionsContainer", "[common]") {
"Function2.x");
REQUIRE(eventsFunctionContainer.GetEventsFunction(2).GetName() ==
"Function3");
REQUIRE(eventsFunctionContainer.GetOwner() ==
gd::EventsFunctionsContainer::FunctionOwner::Extension);
REQUIRE(eventsFunctionContainer2.GetEventsFunctionsCount() == 3);
REQUIRE(eventsFunctionContainer2.GetEventsFunction(0).GetName() ==
"Function1.y");
Expand Down

0 comments on commit 093e15e

Please sign in to comment.