FULLPIPE: Fix deleted queue leaks & clarify flags
This commit is contained in:
parent
073692fd52
commit
39ea2f66ac
2 changed files with 12 additions and 8 deletions
|
@ -362,17 +362,16 @@ bool MessageQueue::load(MfcArchive &file) {
|
||||||
|
|
||||||
bool MessageQueue::chain(StaticANIObject *ani) {
|
bool MessageQueue::chain(StaticANIObject *ani) {
|
||||||
if (checkGlobalExCommandList1() && checkGlobalExCommandList2()) {
|
if (checkGlobalExCommandList1() && checkGlobalExCommandList2()) {
|
||||||
if (!(getFlags() & 2)) {
|
if (!(getFlags() & kInGlobalQueue)) {
|
||||||
g_fp->_globalMessageQueueList->addMessageQueue(this);
|
g_fp->_globalMessageQueueList->addMessageQueue(this);
|
||||||
_flags |= 2;
|
_flags |= kInGlobalQueue;
|
||||||
}
|
}
|
||||||
if (ani) {
|
if (ani) {
|
||||||
ani->queueMessageQueue(this);
|
ani->queueMessageQueue(this);
|
||||||
return true;
|
|
||||||
} else {
|
} else {
|
||||||
sendNextCommand();
|
sendNextCommand();
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -653,8 +652,7 @@ MessageQueue *GlobalMessageQueueList::getMessageQueueById(int id) {
|
||||||
void GlobalMessageQueueList::deleteQueueById(int id) {
|
void GlobalMessageQueueList::deleteQueueById(int id) {
|
||||||
for (uint i = 0; i < size(); i++)
|
for (uint i = 0; i < size(); i++)
|
||||||
if (_storage[i]->_id == id) {
|
if (_storage[i]->_id == id) {
|
||||||
remove_at(i);
|
delete remove_at(i);
|
||||||
|
|
||||||
disableQueueById(id);
|
disableQueueById(id);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -663,7 +661,7 @@ void GlobalMessageQueueList::deleteQueueById(int id) {
|
||||||
void GlobalMessageQueueList::removeQueueById(int id) {
|
void GlobalMessageQueueList::removeQueueById(int id) {
|
||||||
for (uint i = 0; i < size(); i++)
|
for (uint i = 0; i < size(); i++)
|
||||||
if (_storage[i]->_id == id) {
|
if (_storage[i]->_id == id) {
|
||||||
_storage[i]->_flags &= 0xFD; // It is quite pointless
|
_storage[i]->_flags &= ~kInGlobalQueue;
|
||||||
remove_at(i);
|
remove_at(i);
|
||||||
|
|
||||||
disableQueueById(id);
|
disableQueueById(id);
|
||||||
|
@ -708,7 +706,7 @@ int GlobalMessageQueueList::compact() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void GlobalMessageQueueList::addMessageQueue(MessageQueue *msg) {
|
void GlobalMessageQueueList::addMessageQueue(MessageQueue *msg) {
|
||||||
msg->setFlags(msg->getFlags() | 2);
|
msg->setFlags(msg->getFlags() | kInGlobalQueue);
|
||||||
|
|
||||||
push_back(msg);
|
push_back(msg);
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,6 +31,10 @@
|
||||||
|
|
||||||
namespace Fullpipe {
|
namespace Fullpipe {
|
||||||
|
|
||||||
|
enum QueueFlags {
|
||||||
|
kInGlobalQueue = 2
|
||||||
|
};
|
||||||
|
|
||||||
class Message : public CObject {
|
class Message : public CObject {
|
||||||
public:
|
public:
|
||||||
int _messageKind;
|
int _messageKind;
|
||||||
|
@ -146,6 +150,7 @@ class MessageQueue : public CObject {
|
||||||
|
|
||||||
void setParamInt(int key1, int key2);
|
void setParamInt(int key1, int key2);
|
||||||
|
|
||||||
|
/** `ani` will own `this` if `chain` returns true */
|
||||||
bool chain(StaticANIObject *ani);
|
bool chain(StaticANIObject *ani);
|
||||||
void update();
|
void update();
|
||||||
void sendNextCommand();
|
void sendNextCommand();
|
||||||
|
@ -168,6 +173,7 @@ class GlobalMessageQueueList : public Common::Array<MessageQueue *> {
|
||||||
void deleteQueueById(int id);
|
void deleteQueueById(int id);
|
||||||
void removeQueueById(int id);
|
void removeQueueById(int id);
|
||||||
void disableQueueById(int id);
|
void disableQueueById(int id);
|
||||||
|
/** `msg` becomes owned by `this` */
|
||||||
void addMessageQueue(MessageQueue *msg);
|
void addMessageQueue(MessageQueue *msg);
|
||||||
|
|
||||||
int compact();
|
int compact();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue