Line | Source Code | Coverage |
---|
1 | | - |
2 | | - |
3 | QObjectCleanupHandler::QObjectCleanupHandler() | - |
4 | { | - |
5 | } | - |
6 | | - |
7 | | - |
8 | | - |
9 | | - |
10 | | - |
11 | | - |
12 | | - |
13 | QObjectCleanupHandler::~QObjectCleanupHandler() | - |
14 | { | - |
15 | clear(); | - |
16 | } | 0 |
17 | | - |
18 | | - |
19 | | - |
20 | | - |
21 | | - |
22 | | - |
23 | | - |
24 | QObject *QObjectCleanupHandler::add(QObject* object) | - |
25 | { | - |
26 | if (!object) | 0 |
27 | return 0; never executed: return 0; | 0 |
28 | | - |
29 | connect(object, "2""destroyed(QObject*)", this, "1""objectDestroyed(QObject*)"); | - |
30 | cleanupObjects.insert(0, object); | - |
31 | return object; never executed: return object; | 0 |
32 | } | - |
33 | | - |
34 | | - |
35 | | - |
36 | | - |
37 | | - |
38 | | - |
39 | | - |
40 | void QObjectCleanupHandler::remove(QObject *object) | - |
41 | { | - |
42 | int index; | - |
43 | if ((index = cleanupObjects.indexOf(object)) != -1) { never evaluated: (index = cleanupObjects.indexOf(object)) != -1 | 0 |
44 | cleanupObjects.removeAt(index); | - |
45 | disconnect(object, "2""destroyed(QObject*)", this, "1""objectDestroyed(QObject*)"); | - |
46 | } | 0 |
47 | } | 0 |
48 | | - |
49 | | - |
50 | | - |
51 | | - |
52 | | - |
53 | | - |
54 | | - |
55 | bool QObjectCleanupHandler::isEmpty() const | - |
56 | { | - |
57 | return cleanupObjects.isEmpty(); never executed: return cleanupObjects.isEmpty(); | 0 |
58 | } | - |
59 | | - |
60 | | - |
61 | | - |
62 | | - |
63 | | - |
64 | | - |
65 | | - |
66 | void QObjectCleanupHandler::clear() | - |
67 | { | - |
68 | while (!cleanupObjects.isEmpty()) never evaluated: !cleanupObjects.isEmpty() | 0 |
69 | delete cleanupObjects.takeFirst(); never executed: delete cleanupObjects.takeFirst(); | 0 |
70 | } | 0 |
71 | | - |
72 | void QObjectCleanupHandler::objectDestroyed(QObject *object) | - |
73 | { | - |
74 | remove(object); | - |
75 | } | 0 |
76 | | - |
77 | | - |
78 | | - |
| | |