Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/notes/bugfix-21500.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Fix crash when ungrouping a group before calling quit
1 change: 1 addition & 0 deletions engine/src/globals.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1342,6 +1342,7 @@ int X_close(void)
while (MCsavegroupptr != NULL)
{
MCControl *gptr = MCsavegroupptr->remove(MCsavegroupptr);
gptr -> removereferences();
delete gptr;
}

Expand Down
8 changes: 8 additions & 0 deletions tests/lcs/core/engine/_ungroupandquit.livecodescript
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
script "_ungroupandquit"
on startup
create button "one"
create button "two"
group button "one" and button "two"
ungroup the last group

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@livecodepanos aha! that is the issue. ok.. well now the only issue is the release note doesn't match the issue very well

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @montegoulding :)

quit 0
end startup
16 changes: 16 additions & 0 deletions tests/lcs/core/engine/engine.livecodescript
Original file line number Diff line number Diff line change
Expand Up @@ -501,3 +501,19 @@ wait 2 ticks
TestAssert "the ticks change with time", the ticks - tTime >= 2
end TestTicks

on TestUngroupAndQuit
-- Bug 21500: run a subprocess in which we ungroup a group and
-- then quit, to test that it no longer crashes
local tStackToRun, tOptions
put the effective filename of me into tStackToRun
set the itemdelimiter to slash
if the environment is not "server" then
put "_ungroupandquit.livecodescript" into item -1 of tStackToRun
if the environment contains "command line" then
put "-ui" into tOptions
end if
end if
TestRunStack tOptions, tStackToRun
TestAssert "ungroup does not crash on quit", the result is empty
end TestUngroupAndQuit