summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel/qguard.cpp
blob: c61be005a12420e9c3ec3a9b4e3d00a58afea5ca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include "qguard_p.h"
#include <private/qobject_p.h>

void q_guard_addGuard(QGuard<QObject> *g)
{
    QObjectPrivate *p = QObjectPrivate::get(g->o);
    if (p->wasDeleted) {
        qWarning("QGuard: cannot add guard to deleted object");
        g->o = 0;
        return;
    }

    g->next = p->objectGuards;
    p->objectGuards = g;
    g->prev = &p->objectGuards;
    if (g->next)
        g->next->prev = &g->next;
}

void q_guard_removeGuard(QGuard<QObject> *g)
{
    *g->prev = g->next;
    g->next = 0;
    g->prev = 0;
}