~ubuntu-branches/ubuntu/natty/pyside/natty

« back to all changes in this revision

Viewing changes to libpyside/globalreceiver.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Didier Raboud
  • Date: 2011-02-18 18:01:00 UTC
  • mfrom: (1.2.3 upstream) (6.1.6 experimental)
  • Revision ID: james.westby@ubuntu.com-20110218180100-vaczjij7g08fzfme
Tags: 1.0.0~rc1-1
* New 1.0.0~rc1 upstream release
  - Bump the B-D chain versions:
    + apiextractor to 0.10.0-2~
    + generatorrunner to 0.6.6
    + shiboken to 1.0.0~rc1
* Update patches to ~rc1.
* debian/watch: update to handle Release Candidates too.
* Bump XS-Python-Version to >= 2.6.

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
*/
22
22
 
23
23
#include "globalreceiver.h"
 
24
#include "dynamicqmetaobject_p.h"
24
25
 
25
26
#include <QMetaMethod>
26
27
#include <QDebug>
32
33
#include "signalmanager.h"
33
34
 
34
35
#define RECEIVER_DESTROYED_SLOT_NAME "__receiverDestroyed__(QObject*)"
35
 
#define GLOBAL_RECEIVER_CLASS_NAME "__GlobalReceiver__"
36
36
 
37
37
namespace PySide
38
38
{
116
116
 
117
117
GlobalReceiver::~GlobalReceiver()
118
118
{
119
 
    foreach(DynamicSlotData* data, m_slotReceivers) {
 
119
    while(!m_slotReceivers.empty()) {
 
120
        DynamicSlotData* data = m_slotReceivers.take(m_slotReceivers.begin().key());
120
121
        data->clear();
121
122
        delete data;
122
123
    }
203
204
    if (strcmp(slot.signature(), RECEIVER_DESTROYED_SLOT_NAME) == 0) {
204
205
        QObject *arg = *(QObject**)args[1];
205
206
 
206
 
        QHash<int, DynamicSlotData*>::iterator i = m_slotReceivers.begin();
207
 
        while(i != m_slotReceivers.end()) {
 
207
        //avoid hash changes during the destruction
 
208
        QHash<int, DynamicSlotData*> copy = m_slotReceivers;
 
209
        QHash<int, DynamicSlotData*>::iterator i = copy.begin();
 
210
        while(i != copy.end()) {
208
211
            if (i.value()->hasRefTo(arg)) {
209
212
                disconnectNotify(arg, i.key());
210
213
                break;