diff --git a/f8/msgqueue.cc b/f8/msgqueue.cc index b78df6f..fb65e7a 100644 --- a/f8/msgqueue.cc +++ b/f8/msgqueue.cc @@ -48,6 +48,23 @@ namespace f8 MsgQueue::Instance()->RemoveCallBack(pair.second.next); } } + im_msg_mutex_.lock(); + if (!im_work_node_) { + im_work_node_ = im_top_node_; + im_top_node_ = nullptr; + im_bot_node_ = nullptr; + } + while (im_work_node_) { + IMMsgNode* pdelnode = im_work_node_; + im_work_node_ = im_work_node_->next; + delete pdelnode; + if (!im_work_node_) { + im_work_node_ = im_top_node_; + im_top_node_ = nullptr; + im_bot_node_ = nullptr; + } + } + im_msg_mutex_.unlock(); } void Update() @@ -142,29 +159,6 @@ namespace f8 void MsgQueue::UnInit() { - #if 0 - im_msg_mutex_->lock(); - if (!im_work_node_) { - im_work_node_ = im_top_node_; - im_top_node_ = nullptr; - im_bot_node_ = nullptr; - } - while (im_work_node_) { - IMMsgNode* pdelnode = im_work_node_; - im_work_node_ = im_work_node_->next; - if (pdelnode->msgid == f8::IM_SysMsgQueue) { - a8::XParams* param = (a8::XParams*)pdelnode->params.param1.GetUserData(); - delete param; - } - delete pdelnode; - if (!im_work_node_) { - im_work_node_ = im_top_node_; - im_top_node_ = nullptr; - im_bot_node_ = nullptr; - } - } - im_msg_mutex_->unlock(); - #endif } void MsgQueue::Update()