Skip to content

Commit fe568bc

Browse files
committed
[[ Bug 19577 ]] Remove CS_OWN_CONTROLS state from cards
The MCCard object has a 'CS_OWN_CONTROLS' state which it moves to when being deleted. However, this state has not been used since clipboard operations moved to using serialize / unserialize rather than control pointers and such can be be removed.
1 parent 95cd6fd commit fe568bc

File tree

2 files changed

+4
-30
lines changed

2 files changed

+4
-30
lines changed

engine/src/card.cpp

Lines changed: 4 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -205,14 +205,6 @@ MCCard::~MCCard()
205205
close();
206206
while (objptrs != NULL)
207207
{
208-
if (state & CS_OWN_CONTROLS)
209-
{
210-
MCControl *cptr = objptrs->getref();
211-
// MW-2011-08-09: [[ Groups ]] We mustn't delete a shared group even
212-
// if the card owns the controls.
213-
if (cptr->gettype() != CT_GROUP || !static_cast<MCGroup *>(cptr)->isshared())
214-
delete cptr;
215-
}
216208
MCObjptr *optr = objptrs->remove(objptrs);
217209
delete optr;
218210
}
@@ -1139,7 +1131,7 @@ Boolean MCCard::del(bool p_check_flag)
11391131
message(MCM_delete_card);
11401132

11411133
MCundos->freestate();
1142-
state |= CS_NO_MESSAGES | CS_OWN_CONTROLS;
1134+
state |= CS_NO_MESSAGES;
11431135
getstack()->removecard(this);
11441136
state &= ~CS_NO_MESSAGES;
11451137
if (objptrs != NULL)
@@ -1423,8 +1415,6 @@ MCCard *MCCard::clone(Boolean attach, Boolean controls)
14231415

14241416
if (controls)
14251417
{
1426-
if (!attach)
1427-
newcptr->state |= CS_OWN_CONTROLS;
14281418
if (objptrs != NULL)
14291419
{
14301420
newcptr->clonedata(this);
@@ -1454,13 +1444,7 @@ MCCard *MCCard::clone(Boolean attach, Boolean controls)
14541444
newcontrol->setparent(newcptr);
14551445
if (attach)
14561446
{
1457-
if (state & CS_OWN_CONTROLS && oldcontrol->getid() != 0)
1458-
{
1459-
newcontrol->setid(oldcontrol->getid());
1460-
oldcontrol->setid(0);
1461-
}
1462-
else
1463-
newcontrol->setid(newcptr->getstack()->newid());
1447+
newcontrol->setid(newcptr->getstack()->newid());
14641448
newoptr->setid(newcontrol->getid());
14651449
newcptr->getstack()->appendcontrol(newcontrol);
14661450
}
@@ -1473,15 +1457,8 @@ MCCard *MCCard::clone(Boolean attach, Boolean controls)
14731457
}
14741458
if (attach)
14751459
{
1476-
if (state & CS_OWN_CONTROLS && obj_id != 0)
1477-
{
1478-
newcptr->obj_id = obj_id;
1479-
obj_id = 0;
1480-
}
1481-
else
1482-
newcptr->obj_id = newcptr->getstack()->newid();
1460+
newcptr->obj_id = newcptr->getstack()->newid();
14831461
newcptr->getstack()->appendcard(newcptr);
1484-
newcptr->state &= ~CS_OWN_CONTROLS;
14851462
if (diffstack)
14861463
newcptr->replacedata(getstack());
14871464
else
@@ -2690,7 +2667,7 @@ MCObjptr *MCCard::getobjptrforcontrol(MCControl *p_control)
26902667

26912668
void MCCard::clean()
26922669
{
2693-
if (objptrs == NULL || state & CS_OWN_CONTROLS)
2670+
if (objptrs == NULL)
26942671
return;
26952672
clear();
26962673
MCObjptr *tptr = objptrs;
@@ -2717,8 +2694,6 @@ void MCCard::clean()
27172694

27182695
void MCCard::clear()
27192696
{
2720-
if (state & CS_OWN_CONTROLS)
2721-
return;
27222697
MCObjptr *tptr = objptrs;
27232698
do
27242699
{

engine/src/objdefs.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,6 @@ along with LiveCode. If not see <http://www.gnu.org/licenses/>. */
456456
// Uses CS_VSCROLL 15
457457
#define CS_SENDING_RESIZE (1UL << 16)
458458
// MCCard state
459-
#define CS_OWN_CONTROLS (1UL << 14)
460459
#define CS_INSIDE (1UL << 15)
461460
// MCStack state
462461
#define CS_BEEN_MOVED (1UL << 13)

0 commit comments

Comments
 (0)