Fixed GlobalReceiver destructor.
Reviewer: Luciano Wolf <luciano.wolf@openbossa.org>
Hugo Parente Lima <hugo.pl@gmail.com>
This commit is contained in:
parent
276f260f65
commit
ce1cadcacf
1 changed files with 6 additions and 3 deletions
|
|
@ -116,7 +116,8 @@ GlobalReceiver::GlobalReceiver()
|
||||||
|
|
||||||
GlobalReceiver::~GlobalReceiver()
|
GlobalReceiver::~GlobalReceiver()
|
||||||
{
|
{
|
||||||
foreach(DynamicSlotData* data, m_slotReceivers) {
|
while(!m_slotReceivers.empty()) {
|
||||||
|
DynamicSlotData* data = m_slotReceivers.take(m_slotReceivers.begin().key());
|
||||||
data->clear();
|
data->clear();
|
||||||
delete data;
|
delete data;
|
||||||
}
|
}
|
||||||
|
|
@ -203,8 +204,10 @@ int GlobalReceiver::qt_metacall(QMetaObject::Call call, int id, void** args)
|
||||||
if (strcmp(slot.signature(), RECEIVER_DESTROYED_SLOT_NAME) == 0) {
|
if (strcmp(slot.signature(), RECEIVER_DESTROYED_SLOT_NAME) == 0) {
|
||||||
QObject *arg = *(QObject**)args[1];
|
QObject *arg = *(QObject**)args[1];
|
||||||
|
|
||||||
QHash<int, DynamicSlotData*>::iterator i = m_slotReceivers.begin();
|
//avoid hash changes during the destruction
|
||||||
while(i != m_slotReceivers.end()) {
|
QHash<int, DynamicSlotData*> copy = m_slotReceivers;
|
||||||
|
QHash<int, DynamicSlotData*>::iterator i = copy.begin();
|
||||||
|
while(i != copy.end()) {
|
||||||
if (i.value()->hasRefTo(arg)) {
|
if (i.value()->hasRefTo(arg)) {
|
||||||
disconnectNotify(arg, i.key());
|
disconnectNotify(arg, i.key());
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue