Skip to content

Commit cea6bb0

Browse files
committed
Merge branch 'bugfix/iss10863' of https://github.com/montegoulding/livecode into bugfix-10863
2 parents 2788772 + c495027 commit cea6bb0

4 files changed

Lines changed: 26 additions & 10 deletions

File tree

engine/src/cmdsc.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1687,6 +1687,12 @@ Exec_stat MCMakeGroup::exec(MCExecPoint &ep)
16871687
MCeerror->add(EE_GROUP_NOBG, line, pos);
16881688
return ES_ERROR;
16891689
}
1690+
1691+
if (optr->getparent() != (MCControl *)chunkptr->getdestobj()->getparent())
1692+
{
1693+
MCeerror->add(EE_GROUP_DIFFERENTPARENT, line, pos);
1694+
return ES_ERROR;
1695+
}
16901696

16911697
chunkptr->setdestobj(optr);
16921698
chunkptr = chunkptr->next;
@@ -1711,8 +1717,9 @@ Exec_stat MCMakeGroup::exec(MCExecPoint &ep)
17111717
gptr->makegroup(controls, tcard);
17121718
}
17131719
else
1714-
MCselected->group();
1720+
return MCselected->group(line,pos);
17151721
return ES_NORMAL;
1722+
17161723
}
17171724

17181725
MCPasteCmd::~MCPasteCmd()

engine/src/executionerrors.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2371,6 +2371,9 @@ enum Exec_errors
23712371

23722372
// {EE-0778} image cache limit: not a number
23732373
EE_PROPERTY_BADIMAGECACHELIMIT,
2374+
2375+
// {EE-0779} controls don't have the same owner
2376+
EE_GROUP_DIFFERENTPARENT,
23742377
};
23752378

23762379
extern const char *MCexecutionerrors;

engine/src/sellst.cpp

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -271,23 +271,28 @@ MCControl *MCSellist::clone(MCObject *target)
271271
return t_result;
272272
}
273273

274-
void MCSellist::group()
274+
Exec_stat MCSellist::group(uint2 line, uint2 pos)
275275
{
276276
MCresult->clear(False);
277277
if (objects != NULL && objects->ref->gettype() <= CT_FIELD
278278
&& objects->ref->gettype() >= CT_GROUP)
279279
{
280280
MCObject *parent = objects->ref->getparent();
281-
MCSelnode *tptr = objects->next();
282-
while (tptr != objects)
283-
{
281+
MCSelnode *tptr = objects;
282+
do {
283+
if (tptr->ref->gettype() == CT_GROUP && static_cast<MCGroup *>(tptr->ref)->isshared())
284+
{
285+
MCeerror->add(EE_GROUP_NOBG, line, pos);
286+
return ES_ERROR;
287+
}
284288
if (tptr->ref->getparent() != parent)
285289
{
286-
MCresult->sets("controls don't have the same owner");
287-
return;
288-
}
290+
MCeerror->add(EE_GROUP_DIFFERENTPARENT, line, pos);
291+
return ES_ERROR;
292+
}
289293
tptr = tptr->next();
290-
}
294+
} while (tptr != objects);
295+
291296
sort();
292297
MCControl *controls = NULL;
293298
while (objects != NULL)
@@ -318,6 +323,7 @@ void MCSellist::group()
318323
objects = new MCSelnode(gptr);
319324
gptr->message(MCM_selected_object_changed);
320325
}
326+
return ES_NORMAL;
321327
}
322328

323329
bool MCSellist::clipboard(bool p_is_cut)

engine/src/sellst.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ class MCSellist
8484
void sort();
8585
uint32_t count();
8686
MCControl *clone(MCObject *target);
87-
void group();
87+
Exec_stat group(uint2 line, uint2 pos);
8888
Boolean copy();
8989
Boolean cut();
9090
Boolean del();

0 commit comments

Comments
 (0)