Line | Source Code | Coverage |
---|
1 | | - |
2 | | - |
3 | | - |
4 | | - |
5 | class QMutexUnlocker | - |
6 | { | - |
7 | public: | - |
8 | inline explicit QMutexUnlocker(QMutex *m) | - |
9 | : mtx(m) | - |
10 | { } executed: } Execution Count:432410 | 432410 |
11 | inline ~QMutexUnlocker() { unlock(); } executed: } Execution Count:432410 | 432410 |
12 | inline void unlock() { if (mtx) mtx->unlock(); mtx = 0; } executed: mtx->unlock(); Execution Count:432409 evaluated: mtx yes Evaluation Count:432409 | yes Evaluation Count:426527 |
executed: } Execution Count:858934 | 426527-858934 |
13 | | - |
14 | private: | - |
15 | QMutexUnlocker(const QMutexUnlocker &) = delete; QMutexUnlocker &operator=(const QMutexUnlocker &) = delete; | - |
16 | | - |
17 | QMutex *mtx; | - |
18 | }; | - |
19 | int QCoreApplicationPrivate::app_compile_version = 0x050000; | - |
20 | QString QCoreApplicationPrivate::appName() const | - |
21 | { | - |
22 | static QString applName; | - |
23 | | - |
24 | | - |
25 | | - |
26 | if (applName.isEmpty() && argv[0]) { evaluated: applName.isEmpty() yes Evaluation Count:111 | yes Evaluation Count:3214 |
partially evaluated: argv[0] yes Evaluation Count:111 | no Evaluation Count:0 |
| 0-3214 |
27 | char *p = strrchr(argv[0], '/'); | - |
28 | applName = QString::fromLocal8Bit(p ? p + 1 : argv[0]); | - |
29 | } executed: } Execution Count:111 | 111 |
30 | return applName; executed: return applName; Execution Count:3325 | 3325 |
31 | } | - |
32 | | - |
33 | | - |
34 | bool QCoreApplicationPrivate::checkInstance(const char *function) | - |
35 | { | - |
36 | bool b = (QCoreApplication::self != 0); | - |
37 | if (!b) partially evaluated: !b no Evaluation Count:0 | yes Evaluation Count:138 |
| 0-138 |
38 | QMessageLogger("kernel/qcoreapplication.cpp", 155, __PRETTY_FUNCTION__).warning("QApplication::%s: Please instantiate the QApplication object first", function); never executed: QMessageLogger("kernel/qcoreapplication.cpp", 155, __PRETTY_FUNCTION__).warning("QApplication::%s: Please instantiate the QApplication object first", function); | 0 |
39 | return b; executed: return b; Execution Count:138 | 138 |
40 | } | - |
41 | | - |
42 | void QCoreApplicationPrivate::processCommandLineArguments() | - |
43 | { | - |
44 | int j = argc ? 1 : 0; evaluated: argc yes Evaluation Count:44 | yes Evaluation Count:88 |
| 44-88 |
45 | for (int i = 1; i < argc; ++i) { evaluated: i < argc yes Evaluation Count:12 | yes Evaluation Count:132 |
| 12-132 |
46 | if (argv[i] && *argv[i] != '-') { partially evaluated: argv[i] yes Evaluation Count:12 | no Evaluation Count:0 |
evaluated: *argv[i] != '-' yes Evaluation Count:6 | yes Evaluation Count:6 |
| 0-12 |
47 | argv[j++] = argv[i]; | - |
48 | continue; executed: continue; Execution Count:6 | 6 |
49 | } | - |
50 | QByteArray arg = argv[i]; | - |
51 | if (arg.startsWith("-qmljsdebugger=")) { evaluated: arg.startsWith("-qmljsdebugger=") yes Evaluation Count:1 | yes Evaluation Count:5 |
| 1-5 |
52 | qmljs_debug_arguments = QString::fromLocal8Bit(arg.right(arg.length() - 15)); | - |
53 | } else if (arg == "-qmljsdebugger" && i < argc - 1) { partially evaluated: arg == "-qmljsdebugger" no Evaluation Count:0 | yes Evaluation Count:5 |
never evaluated: i < argc - 1 executed: } Execution Count:1 | 0-5 |
54 | ++i; | - |
55 | qmljs_debug_arguments = QString::fromLocal8Bit(argv[i]); | - |
56 | } else { | 0 |
57 | argv[j++] = argv[i]; | - |
58 | } executed: } Execution Count:5 | 5 |
59 | } | - |
60 | | - |
61 | if (j < argc) { evaluated: j < argc yes Evaluation Count:1 | yes Evaluation Count:131 |
| 1-131 |
62 | argv[j] = 0; | - |
63 | argc = j; | - |
64 | } executed: } Execution Count:1 | 1 |
65 | } executed: } Execution Count:132 | 132 |
66 | | - |
67 | | - |
68 | | - |
69 | QSignalSpyCallbackSet __attribute__((visibility("default"))) qt_signal_spy_callback_set = { 0, 0, 0, 0 }; | - |
70 | | - |
71 | void qt_register_signal_spy_callbacks(const QSignalSpyCallbackSet &callback_set) | - |
72 | { | - |
73 | qt_signal_spy_callback_set = callback_set; | - |
74 | } executed: } Execution Count:376 | 376 |
75 | | - |
76 | extern "C" void __attribute__((visibility("default"))) qt_startup_hook() | - |
77 | { | - |
78 | } | - |
79 | | - |
80 | typedef QList<QtCleanUpFunction> QVFuncList; | - |
81 | static QVFuncList *postRList() { static QGlobalStatic<QVFuncList > thisGlobalStatic = { { (0) }, false }; if (!thisGlobalStatic.pointer.load() && !thisGlobalStatic.destroyed) { QVFuncList *x = new QVFuncList; if (!thisGlobalStatic.pointer.testAndSetOrdered(0, x)) delete x; else static QGlobalStaticDeleter<QVFuncList > cleanup(thisGlobalStatic); } return thisGlobalStatic.pointer.load(); } never executed: delete x; executed: return thisGlobalStatic.pointer.load(); Execution Count:751 partially evaluated: !thisGlobalStatic.pointer.testAndSetOrdered(0, x) no Evaluation Count:0 | yes Evaluation Count:158 |
evaluated: !thisGlobalStatic.pointer.load() yes Evaluation Count:158 | yes Evaluation Count:593 |
partially evaluated: !thisGlobalStatic.destroyed yes Evaluation Count:158 | no Evaluation Count:0 |
| 0-751 |
82 | | - |
83 | void qAddPostRoutine(QtCleanUpFunction p) | - |
84 | { | - |
85 | QVFuncList *list = postRList(); | - |
86 | if (!list) partially evaluated: !list no Evaluation Count:0 | yes Evaluation Count:117 |
| 0-117 |
87 | return; | 0 |
88 | list->prepend(p); | - |
89 | } executed: } Execution Count:117 | 117 |
90 | | - |
91 | void qRemovePostRoutine(QtCleanUpFunction p) | - |
92 | { | - |
93 | QVFuncList *list = postRList(); | - |
94 | if (!list) | 0 |
95 | return; | 0 |
96 | list->removeAll(p); | - |
97 | } | 0 |
98 | | - |
99 | void __attribute__((visibility("default"))) qt_call_post_routines() | - |
100 | { | - |
101 | QVFuncList *list = 0; | - |
102 | try { | - |
103 | list = postRList(); | - |
104 | } catch (const std::bad_alloc &) { executed: } Execution Count:634 | 634 |
105 | | - |
106 | | - |
107 | | - |
108 | } | 0 |
109 | if (!list) partially evaluated: !list no Evaluation Count:0 | yes Evaluation Count:634 |
| 0-634 |
110 | return; | 0 |
111 | while (!list->isEmpty()) evaluated: !list->isEmpty() yes Evaluation Count:278 | yes Evaluation Count:634 |
| 278-634 |
112 | (list->takeFirst())(); executed: (list->takeFirst())(); Execution Count:278 | 278 |
113 | } executed: } Execution Count:634 | 634 |
114 | | - |
115 | | - |
116 | | - |
117 | bool QCoreApplicationPrivate::is_app_running = false; | - |
118 | | - |
119 | bool QCoreApplicationPrivate::is_app_closing = false; | - |
120 | | - |
121 | static bool qt_locale_initialized = false; | - |
122 | | - |
123 | __attribute__((visibility("default"))) uint qGlobalPostedEventsCount() | - |
124 | { | - |
125 | QThreadData *currentThreadData = QThreadData::current(); | - |
126 | return currentThreadData->postEventList.size() - currentThreadData->postEventList.startOffset; executed: return currentThreadData->postEventList.size() - currentThreadData->postEventList.startOffset; Execution Count:8 | 8 |
127 | } | - |
128 | | - |
129 | QCoreApplication *QCoreApplication::self = 0; | - |
130 | QAbstractEventDispatcher *QCoreApplicationPrivate::eventDispatcher = 0; | - |
131 | uint QCoreApplicationPrivate::attribs = (1 << Qt::AA_SynthesizeMouseForUnhandledTouchEvents); | - |
132 | | - |
133 | | - |
134 | Qt::HANDLE qt_application_thread_id = 0; | - |
135 | | - |
136 | | - |
137 | struct QCoreApplicationData { | - |
138 | QCoreApplicationData() { | - |
139 | | - |
140 | app_libpaths = 0; | - |
141 | | - |
142 | } executed: } Execution Count:6 | 6 |
143 | ~QCoreApplicationData() { | - |
144 | | - |
145 | delete app_libpaths; | - |
146 | | - |
147 | | - |
148 | | - |
149 | if (QCoreApplicationPrivate::theMainThread) { partially evaluated: QCoreApplicationPrivate::theMainThread yes Evaluation Count:343 | no Evaluation Count:0 |
| 0-343 |
150 | QThreadData *data = QThreadData::get2(QCoreApplicationPrivate::theMainThread); | - |
151 | QCoreApplicationPrivate::theMainThread = 0; | - |
152 | data->deref(); | - |
153 | } executed: } Execution Count:343 | 343 |
154 | } executed: } Execution Count:343 | 343 |
155 | QString orgName, orgDomain, application; | - |
156 | QString applicationVersion; | - |
157 | | - |
158 | | - |
159 | QStringList *app_libpaths; | - |
160 | | - |
161 | | - |
162 | }; | - |
163 | | - |
164 | static QCoreApplicationData *coreappdata() { static QGlobalStatic<QCoreApplicationData > thisGlobalStatic = { { (0) }, false }; if (!thisGlobalStatic.pointer.load() && !thisGlobalStatic.destroyed) { QCoreApplicationData *x = new QCoreApplicationData; if (!thisGlobalStatic.pointer.testAndSetOrdered(0, x)) delete x; else static QGlobalStaticDeleter<QCoreApplicationData > cleanup(thisGlobalStatic); } return thisGlobalStatic.pointer.load(); } never executed: delete x; executed: return thisGlobalStatic.pointer.load(); Execution Count:12265 partially evaluated: !thisGlobalStatic.pointer.testAndSetOrdered(0, x) no Evaluation Count:0 | yes Evaluation Count:6 |
evaluated: !thisGlobalStatic.pointer.load() yes Evaluation Count:6 | yes Evaluation Count:12259 |
partially evaluated: !thisGlobalStatic.destroyed yes Evaluation Count:6 | no Evaluation Count:0 |
| 0-12265 |
165 | | - |
166 | static bool quitLockRefEnabled = true; | - |
167 | | - |
168 | QCoreApplicationPrivate::QCoreApplicationPrivate(int &aargc, char **aargv, uint flags) | - |
169 | : QObjectPrivate() | - |
170 | , argc(aargc) | - |
171 | , argv(aargv) | - |
172 | | - |
173 | | - |
174 | | - |
175 | | - |
176 | , application_type(0) | - |
177 | , in_exec(false) | - |
178 | , aboutToQuitEmitted(false) | - |
179 | , threadData_clean(false) | - |
180 | { | - |
181 | app_compile_version = flags & 0xffffff; | - |
182 | static const char *const empty = ""; | - |
183 | if (argc == 0 || argv == 0) { evaluated: argc == 0 yes Evaluation Count:88 | yes Evaluation Count:44 |
partially evaluated: argv == 0 no Evaluation Count:0 | yes Evaluation Count:44 |
| 0-88 |
184 | argc = 0; | - |
185 | argv = (char **)∅ | - |
186 | } executed: } Execution Count:88 | 88 |
187 | QCoreApplicationPrivate::is_app_closing = false; | - |
188 | | - |
189 | | - |
190 | qt_application_thread_id = QThread::currentThreadId(); | - |
191 | | - |
192 | | - |
193 | | - |
194 | | - |
195 | | - |
196 | if (QThread::currentThread() != theMainThread) partially evaluated: QThread::currentThread() != theMainThread no Evaluation Count:0 | yes Evaluation Count:132 |
| 0-132 |
197 | QMessageLogger("kernel/qcoreapplication.cpp", 343, __PRETTY_FUNCTION__).warning("WARNING: QApplication was not created in the main() thread."); never executed: QMessageLogger("kernel/qcoreapplication.cpp", 343, __PRETTY_FUNCTION__).warning("WARNING: QApplication was not created in the main() thread."); | 0 |
198 | } executed: } Execution Count:132 | 132 |
199 | | - |
200 | QCoreApplicationPrivate::~QCoreApplicationPrivate() | - |
201 | { | - |
202 | cleanupThreadData(); | - |
203 | | - |
204 | | - |
205 | | - |
206 | } executed: } Execution Count:451 | 451 |
207 | | - |
208 | void QCoreApplicationPrivate::cleanupThreadData() | - |
209 | { | - |
210 | if (threadData && !threadData_clean) { partially evaluated: threadData yes Evaluation Count:709 | no Evaluation Count:0 |
evaluated: !threadData_clean yes Evaluation Count:451 | yes Evaluation Count:258 |
| 0-709 |
211 | | - |
212 | void *data = &threadData->tls; | - |
213 | QThreadStorageData::finish((void **)data); | - |
214 | | - |
215 | | - |
216 | | - |
217 | QMutexLocker locker(&threadData->postEventList.mutex); | - |
218 | for (int i = 0; i < threadData->postEventList.size(); ++i) { evaluated: i < threadData->postEventList.size() yes Evaluation Count:6287 | yes Evaluation Count:451 |
| 451-6287 |
219 | const QPostEvent &pe = threadData->postEventList.at(i); | - |
220 | if (pe.event) { evaluated: pe.event yes Evaluation Count:6275 | yes Evaluation Count:12 |
| 12-6275 |
221 | --pe.receiver->d_func()->postedEvents; | - |
222 | pe.event->posted = false; | - |
223 | delete pe.event; | - |
224 | } executed: } Execution Count:6275 | 6275 |
225 | } executed: } Execution Count:6287 | 6287 |
226 | threadData->postEventList.clear(); | - |
227 | threadData->postEventList.recursion = 0; | - |
228 | threadData->quitNow = false; | - |
229 | threadData_clean = true; | - |
230 | } executed: } Execution Count:451 | 451 |
231 | } executed: } Execution Count:709 | 709 |
232 | | - |
233 | void QCoreApplicationPrivate::createEventDispatcher() | - |
234 | { | - |
235 | QCoreApplication * const q = q_func(); | - |
236 | | - |
237 | | - |
238 | | - |
239 | | - |
240 | | - |
241 | if (qEnvironmentVariableIsEmpty("QT_NO_GLIB") && QEventDispatcherGlib::versionSupported()) partially evaluated: qEnvironmentVariableIsEmpty("QT_NO_GLIB") yes Evaluation Count:38 | no Evaluation Count:0 |
partially evaluated: QEventDispatcherGlib::versionSupported() yes Evaluation Count:38 | no Evaluation Count:0 |
| 0-38 |
242 | eventDispatcher = new QEventDispatcherGlib(q); executed: eventDispatcher = new QEventDispatcherGlib(q); Execution Count:38 | 38 |
243 | else | - |
244 | | - |
245 | eventDispatcher = new QEventDispatcherUNIX(q); never executed: eventDispatcher = new QEventDispatcherUNIX(q); | 0 |
246 | | - |
247 | | - |
248 | | - |
249 | | - |
250 | | - |
251 | | - |
252 | } | - |
253 | | - |
254 | QThread *QCoreApplicationPrivate::theMainThread = 0; | - |
255 | QThread *QCoreApplicationPrivate::mainThread() | - |
256 | { | - |
257 | qt_noop(); | - |
258 | return theMainThread; executed: return theMainThread; Execution Count:8699 | 8699 |
259 | } | - |
260 | void QCoreApplicationPrivate::appendApplicationPathToLibraryPaths() | - |
261 | { | - |
262 | | - |
263 | QStringList *app_libpaths = coreappdata()->app_libpaths; | - |
264 | if (!app_libpaths) partially evaluated: !app_libpaths no Evaluation Count:0 | yes Evaluation Count:31 |
| 0-31 |
265 | coreappdata()->app_libpaths = app_libpaths = new QStringList; never executed: coreappdata()->app_libpaths = app_libpaths = new QStringList; | 0 |
266 | QString app_location = QCoreApplication::applicationFilePath(); | - |
267 | app_location.truncate(app_location.lastIndexOf(QLatin1Char('/'))); | - |
268 | app_location = QDir(app_location).canonicalPath(); | - |
269 | if (QFile::exists(app_location) && !app_libpaths->contains(app_location)) partially evaluated: QFile::exists(app_location) yes Evaluation Count:31 | no Evaluation Count:0 |
evaluated: !app_libpaths->contains(app_location) yes Evaluation Count:28 | yes Evaluation Count:3 |
| 0-31 |
270 | app_libpaths->append(app_location); executed: app_libpaths->append(app_location); Execution Count:28 | 28 |
271 | | - |
272 | } executed: } Execution Count:31 | 31 |
273 | | - |
274 | QString qAppName() | - |
275 | { | - |
276 | if (!QCoreApplicationPrivate::checkInstance("qAppName")) partially evaluated: !QCoreApplicationPrivate::checkInstance("qAppName") no Evaluation Count:0 | yes Evaluation Count:3 |
| 0-3 |
277 | return QString(); never executed: return QString(); | 0 |
278 | return QCoreApplication::instance()->d_func()->appName(); executed: return QCoreApplication::instance()->d_func()->appName(); Execution Count:3 | 3 |
279 | } | - |
280 | | - |
281 | void QCoreApplicationPrivate::initLocale() | - |
282 | { | - |
283 | if (qt_locale_initialized) evaluated: qt_locale_initialized yes Evaluation Count:126 | yes Evaluation Count:6 |
| 6-126 |
284 | return; executed: return; Execution Count:126 | 126 |
285 | qt_locale_initialized = true; | - |
286 | | - |
287 | setlocale(__LC_ALL, ""); | - |
288 | | - |
289 | } executed: } Execution Count:6 | 6 |
290 | QCoreApplication::QCoreApplication(QCoreApplicationPrivate &p) | - |
291 | : QObject(p, 0) | - |
292 | { | - |
293 | init(); | - |
294 | | - |
295 | | - |
296 | } executed: } Execution Count:93 | 93 |
297 | void QCoreApplication::flush() | - |
298 | { | - |
299 | if (self && self->d_func()->eventDispatcher) partially evaluated: self yes Evaluation Count:256 | no Evaluation Count:0 |
partially evaluated: self->d_func()->eventDispatcher yes Evaluation Count:256 | no Evaluation Count:0 |
| 0-256 |
300 | self->d_func()->eventDispatcher->flush(); executed: self->d_func()->eventDispatcher->flush(); Execution Count:256 | 256 |
301 | } executed: } Execution Count:256 | 256 |
302 | QCoreApplication::QCoreApplication(int &argc, char **argv | - |
303 | | - |
304 | , int _internal | - |
305 | | - |
306 | ) | - |
307 | : QObject(*new QCoreApplicationPrivate(argc, argv, _internal)) | - |
308 | { | - |
309 | init(); | - |
310 | QCoreApplicationPrivate::eventDispatcher->startingUp(); | - |
311 | } executed: } Execution Count:39 | 39 |
312 | | - |
313 | | - |
314 | | - |
315 | void QCoreApplication::init() | - |
316 | { | - |
317 | QCoreApplicationPrivate * const d = d_func(); | - |
318 | | - |
319 | QCoreApplicationPrivate::initLocale(); | - |
320 | | - |
321 | qt_noop(); | - |
322 | QCoreApplication::self = this; | - |
323 | | - |
324 | | - |
325 | if (!QCoreApplicationPrivate::eventDispatcher) partially evaluated: !QCoreApplicationPrivate::eventDispatcher yes Evaluation Count:132 | no Evaluation Count:0 |
| 0-132 |
326 | QCoreApplicationPrivate::eventDispatcher = d->threadData->eventDispatcher; executed: QCoreApplicationPrivate::eventDispatcher = d->threadData->eventDispatcher; Execution Count:132 | 132 |
327 | | - |
328 | if (!QCoreApplicationPrivate::eventDispatcher) evaluated: !QCoreApplicationPrivate::eventDispatcher yes Evaluation Count:131 | yes Evaluation Count:1 |
| 1-131 |
329 | d->createEventDispatcher(); executed: d->createEventDispatcher(); Execution Count:131 | 131 |
330 | qt_noop(); | - |
331 | | - |
332 | if (!QCoreApplicationPrivate::eventDispatcher->parent()) { evaluated: !QCoreApplicationPrivate::eventDispatcher->parent() yes Evaluation Count:1 | yes Evaluation Count:131 |
| 1-131 |
333 | QCoreApplicationPrivate::eventDispatcher->moveToThread(d->threadData->thread); | - |
334 | QCoreApplicationPrivate::eventDispatcher->setParent(this); | - |
335 | } executed: } Execution Count:1 | 1 |
336 | | - |
337 | d->threadData->eventDispatcher = QCoreApplicationPrivate::eventDispatcher; | - |
338 | | - |
339 | | - |
340 | if (coreappdata()->app_libpaths) evaluated: coreappdata()->app_libpaths yes Evaluation Count:5 | yes Evaluation Count:127 |
| 5-127 |
341 | d->appendApplicationPathToLibraryPaths(); executed: d->appendApplicationPathToLibraryPaths(); Execution Count:5 | 5 |
342 | | - |
343 | | - |
344 | | - |
345 | | - |
346 | | - |
347 | QProcessPrivate::initializeProcessManager(); | - |
348 | | - |
349 | | - |
350 | | - |
351 | | - |
352 | | - |
353 | | - |
354 | | - |
355 | d->processCommandLineArguments(); | - |
356 | | - |
357 | qt_startup_hook(); | - |
358 | } executed: } Execution Count:132 | 132 |
359 | | - |
360 | | - |
361 | | - |
362 | | - |
363 | QCoreApplication::~QCoreApplication() | - |
364 | { | - |
365 | qt_call_post_routines(); | - |
366 | | - |
367 | self = 0; | - |
368 | QCoreApplicationPrivate::is_app_closing = true; | - |
369 | QCoreApplicationPrivate::is_app_running = false; | - |
370 | | - |
371 | | - |
372 | | - |
373 | QThreadPool *globalThreadPool = 0; | - |
374 | try { | - |
375 | globalThreadPool = QThreadPool::globalInstance(); | - |
376 | } catch (...) { executed: } Execution Count:451 | 451 |
377 | | - |
378 | } | 0 |
379 | if (globalThreadPool) partially evaluated: globalThreadPool yes Evaluation Count:451 | no Evaluation Count:0 |
| 0-451 |
380 | globalThreadPool->waitForDone(); executed: globalThreadPool->waitForDone(); Execution Count:451 | 451 |
381 | | - |
382 | | - |
383 | d_func()->threadData->eventDispatcher = 0; | - |
384 | if (QCoreApplicationPrivate::eventDispatcher) evaluated: QCoreApplicationPrivate::eventDispatcher yes Evaluation Count:193 | yes Evaluation Count:258 |
| 193-258 |
385 | QCoreApplicationPrivate::eventDispatcher->closingDown(); executed: QCoreApplicationPrivate::eventDispatcher->closingDown(); Execution Count:193 | 193 |
386 | QCoreApplicationPrivate::eventDispatcher = 0; | - |
387 | | - |
388 | | - |
389 | delete coreappdata()->app_libpaths; | - |
390 | coreappdata()->app_libpaths = 0; | - |
391 | | - |
392 | } executed: } Execution Count:451 | 451 |
393 | void QCoreApplication::setAttribute(Qt::ApplicationAttribute attribute, bool on) | - |
394 | { | - |
395 | if (on) evaluated: on yes Evaluation Count:99 | yes Evaluation Count:4 |
| 4-99 |
396 | QCoreApplicationPrivate::attribs |= 1 << attribute; executed: QCoreApplicationPrivate::attribs |= 1 << attribute; Execution Count:99 | 99 |
397 | else | - |
398 | QCoreApplicationPrivate::attribs &= ~(1 << attribute); executed: QCoreApplicationPrivate::attribs &= ~(1 << attribute); Execution Count:4 | 4 |
399 | } | - |
400 | | - |
401 | | - |
402 | | - |
403 | | - |
404 | | - |
405 | | - |
406 | | - |
407 | bool QCoreApplication::testAttribute(Qt::ApplicationAttribute attribute) | - |
408 | { | - |
409 | return QCoreApplicationPrivate::testAttribute(attribute); executed: return QCoreApplicationPrivate::testAttribute(attribute); Execution Count:608620 | 608620 |
410 | } | - |
411 | bool QCoreApplication::isQuitLockEnabled() | - |
412 | { | - |
413 | return quitLockRefEnabled; executed: return quitLockRefEnabled; Execution Count:12 | 12 |
414 | } | - |
415 | void QCoreApplication::setQuitLockEnabled(bool enabled) | - |
416 | { | - |
417 | quitLockRefEnabled = enabled; | - |
418 | } | 0 |
419 | | - |
420 | | - |
421 | | - |
422 | | - |
423 | | - |
424 | | - |
425 | | - |
426 | bool QCoreApplication::notifyInternal(QObject *receiver, QEvent *event) | - |
427 | { | - |
428 | | - |
429 | | - |
430 | bool result = false; | - |
431 | void *cbdata[] = { receiver, event, &result }; | - |
432 | if (QInternal::activateCallbacks(QInternal::EventNotifyCallback, cbdata)) { partially evaluated: QInternal::activateCallbacks(QInternal::EventNotifyCallback, cbdata) no Evaluation Count:0 | yes Evaluation Count:961770 |
| 0-961770 |
433 | return result; never executed: return result; | 0 |
434 | } | - |
435 | | - |
436 | | - |
437 | | - |
438 | | - |
439 | | - |
440 | QObjectPrivate *d = receiver->d_func(); | - |
441 | QThreadData *threadData = d->threadData; | - |
442 | QScopedLoopLevelCounter loopLevelCounter(threadData); | - |
443 | return notify(receiver, event); executed: return notify(receiver, event); Execution Count:961726 | 961726 |
444 | } | - |
445 | bool QCoreApplication::notify(QObject *receiver, QEvent *event) | - |
446 | { | - |
447 | QCoreApplicationPrivate * const d = d_func(); | - |
448 | | - |
449 | if (QCoreApplicationPrivate::is_app_closing) evaluated: QCoreApplicationPrivate::is_app_closing yes Evaluation Count:183 | yes Evaluation Count:480737 |
| 183-480737 |
450 | return true; executed: return true; Execution Count:183 | 183 |
451 | | - |
452 | if (receiver == 0) { partially evaluated: receiver == 0 no Evaluation Count:0 | yes Evaluation Count:480750 |
| 0-480750 |
453 | QMessageLogger("kernel/qcoreapplication.cpp", 821, __PRETTY_FUNCTION__).warning("QCoreApplication::notify: Unexpected null receiver"); | - |
454 | return true; never executed: return true; | 0 |
455 | } | - |
456 | | - |
457 | | - |
458 | | - |
459 | | - |
460 | | - |
461 | return receiver->isWidgetType() ? false : d->notify_helper(receiver, event); executed: return receiver->isWidgetType() ? false : d->notify_helper(receiver, event); Execution Count:480729 | 480729 |
462 | } | - |
463 | | - |
464 | bool QCoreApplicationPrivate::sendThroughApplicationEventFilters(QObject *receiver, QEvent *event) | - |
465 | { | - |
466 | if (receiver->d_func()->threadData == this->threadData && extraData) { evaluated: receiver->d_func()->threadData == this->threadData yes Evaluation Count:883840 | yes Evaluation Count:98758 |
evaluated: extraData yes Evaluation Count:57477 | yes Evaluation Count:826363 |
| 57477-883840 |
467 | | - |
468 | for (int i = 0; i < extraData->eventFilters.size(); ++i) { evaluated: i < extraData->eventFilters.size() yes Evaluation Count:85031 | yes Evaluation Count:57476 |
| 57476-85031 |
469 | register QObject *obj = extraData->eventFilters.at(i); | - |
470 | if (!obj) evaluated: !obj yes Evaluation Count:16664 | yes Evaluation Count:68367 |
| 16664-68367 |
471 | continue; executed: continue; Execution Count:16664 | 16664 |
472 | if (obj->d_func()->threadData != threadData) { partially evaluated: obj->d_func()->threadData != threadData no Evaluation Count:0 | yes Evaluation Count:68367 |
| 0-68367 |
473 | QMessageLogger("kernel/qcoreapplication.cpp", 841, __PRETTY_FUNCTION__).warning("QCoreApplication: Application event filter cannot be in a different thread."); | - |
474 | continue; never executed: continue; | 0 |
475 | } | - |
476 | if (obj->eventFilter(receiver, event)) evaluated: obj->eventFilter(receiver, event) yes Evaluation Count:1 | yes Evaluation Count:68366 |
| 1-68366 |
477 | return true; executed: return true; Execution Count:1 | 1 |
478 | } executed: } Execution Count:68366 | 68366 |
479 | } executed: } Execution Count:57476 | 57476 |
480 | return false; executed: return false; Execution Count:982565 | 982565 |
481 | } | - |
482 | | - |
483 | bool QCoreApplicationPrivate::sendThroughObjectEventFilters(QObject *receiver, QEvent *event) | - |
484 | { | - |
485 | QCoreApplication * const q = q_func(); | - |
486 | if (receiver != q && receiver->d_func()->extraData) { evaluated: receiver != q yes Evaluation Count:981033 | yes Evaluation Count:1505 |
evaluated: receiver->d_func()->extraData yes Evaluation Count:254266 | yes Evaluation Count:726808 |
| 1505-981033 |
487 | for (int i = 0; i < receiver->d_func()->extraData->eventFilters.size(); ++i) { evaluated: i < receiver->d_func()->extraData->eventFilters.size() yes Evaluation Count:94455 | yes Evaluation Count:236027 |
| 94455-236027 |
488 | register QObject *obj = receiver->d_func()->extraData->eventFilters.at(i); | - |
489 | if (!obj) evaluated: !obj yes Evaluation Count:6295 | yes Evaluation Count:88160 |
| 6295-88160 |
490 | continue; executed: continue; Execution Count:6295 | 6295 |
491 | if (obj->d_func()->threadData != receiver->d_func()->threadData) { evaluated: obj->d_func()->threadData != receiver->d_func()->threadData yes Evaluation Count:1 | yes Evaluation Count:88159 |
| 1-88159 |
492 | QMessageLogger("kernel/qcoreapplication.cpp", 860, __PRETTY_FUNCTION__).warning("QCoreApplication: Object event filter cannot be in a different thread."); | - |
493 | continue; executed: continue; Execution Count:1 | 1 |
494 | } | - |
495 | if (obj->eventFilter(receiver, event)) evaluated: obj->eventFilter(receiver, event) yes Evaluation Count:18238 | yes Evaluation Count:69920 |
| 18238-69920 |
496 | return true; executed: return true; Execution Count:18238 | 18238 |
497 | } executed: } Execution Count:69920 | 69920 |
498 | } executed: } Execution Count:236027 | 236027 |
499 | return false; executed: return false; Execution Count:964368 | 964368 |
500 | } | - |
501 | | - |
502 | | - |
503 | | - |
504 | | - |
505 | | - |
506 | | - |
507 | bool QCoreApplicationPrivate::notify_helper(QObject *receiver, QEvent * event) | - |
508 | { | - |
509 | | - |
510 | if (sendThroughApplicationEventFilters(receiver, event)) partially evaluated: sendThroughApplicationEventFilters(receiver, event) no Evaluation Count:0 | yes Evaluation Count:480651 |
| 0-480651 |
511 | return true; never executed: return true; | 0 |
512 | | - |
513 | if (sendThroughObjectEventFilters(receiver, event)) partially evaluated: sendThroughObjectEventFilters(receiver, event) no Evaluation Count:0 | yes Evaluation Count:480701 |
| 0-480701 |
514 | return true; never executed: return true; | 0 |
515 | | - |
516 | return receiver->event(event); executed: return receiver->event(event); Execution Count:480702 | 480702 |
517 | } | - |
518 | bool QCoreApplication::startingUp() | - |
519 | { | - |
520 | return !QCoreApplicationPrivate::is_app_running; executed: return !QCoreApplicationPrivate::is_app_running; Execution Count:7 | 7 |
521 | } | - |
522 | bool QCoreApplication::closingDown() | - |
523 | { | - |
524 | return QCoreApplicationPrivate::is_app_closing; executed: return QCoreApplicationPrivate::is_app_closing; Execution Count:40830 | 40830 |
525 | } | - |
526 | void QCoreApplication::processEvents(QEventLoop::ProcessEventsFlags flags) | - |
527 | { | - |
528 | QThreadData *data = QThreadData::current(); | - |
529 | if (!data->eventDispatcher) evaluated: !data->eventDispatcher yes Evaluation Count:1 | yes Evaluation Count:390158 |
| 1-390158 |
530 | return; executed: return; Execution Count:1 | 1 |
531 | data->eventDispatcher->processEvents(flags); | - |
532 | } executed: } Execution Count:390154 | 390154 |
533 | void QCoreApplication::processEvents(QEventLoop::ProcessEventsFlags flags, int maxtime) | - |
534 | { | - |
535 | QThreadData *data = QThreadData::current(); | - |
536 | if (!data->eventDispatcher) partially evaluated: !data->eventDispatcher no Evaluation Count:0 | yes Evaluation Count:57830 |
| 0-57830 |
537 | return; | 0 |
538 | QElapsedTimer start; | - |
539 | start.start(); | - |
540 | while (data->eventDispatcher->processEvents(flags & ~QEventLoop::WaitForMoreEvents)) { evaluated: data->eventDispatcher->processEvents(flags & ~QEventLoop::WaitForMoreEvents) yes Evaluation Count:39469 | yes Evaluation Count:57758 |
| 39469-57758 |
541 | if (start.elapsed() > maxtime) evaluated: start.elapsed() > maxtime yes Evaluation Count:34 | yes Evaluation Count:39436 |
| 34-39436 |
542 | break; executed: break; Execution Count:34 | 34 |
543 | } executed: } Execution Count:39436 | 39436 |
544 | } executed: } Execution Count:57788 | 57788 |
545 | int QCoreApplication::exec() | - |
546 | { | - |
547 | if (!QCoreApplicationPrivate::checkInstance("exec")) partially evaluated: !QCoreApplicationPrivate::checkInstance("exec") no Evaluation Count:0 | yes Evaluation Count:62 |
| 0-62 |
548 | return -1; never executed: return -1; | 0 |
549 | | - |
550 | QThreadData *threadData = self->d_func()->threadData; | - |
551 | if (threadData != QThreadData::current()) { partially evaluated: threadData != QThreadData::current() no Evaluation Count:0 | yes Evaluation Count:62 |
| 0-62 |
552 | QMessageLogger("kernel/qcoreapplication.cpp", 1008, __PRETTY_FUNCTION__).warning("%s::exec: Must be called from the main thread", self->metaObject()->className()); | - |
553 | return -1; never executed: return -1; | 0 |
554 | } | - |
555 | if (!threadData->eventLoops.isEmpty()) { partially evaluated: !threadData->eventLoops.isEmpty() no Evaluation Count:0 | yes Evaluation Count:62 |
| 0-62 |
556 | QMessageLogger("kernel/qcoreapplication.cpp", 1012, __PRETTY_FUNCTION__).warning("QCoreApplication::exec: The event loop is already running"); | - |
557 | return -1; never executed: return -1; | 0 |
558 | } | - |
559 | | - |
560 | threadData->quitNow = false; | - |
561 | QEventLoop eventLoop; | - |
562 | self->d_func()->in_exec = true; | - |
563 | self->d_func()->aboutToQuitEmitted = false; | - |
564 | int returnCode = eventLoop.exec(); | - |
565 | threadData->quitNow = false; | - |
566 | if (self) { partially evaluated: self yes Evaluation Count:62 | no Evaluation Count:0 |
| 0-62 |
567 | self->d_func()->in_exec = false; | - |
568 | if (!self->d_func()->aboutToQuitEmitted) partially evaluated: !self->d_func()->aboutToQuitEmitted yes Evaluation Count:62 | no Evaluation Count:0 |
| 0-62 |
569 | self->aboutToQuit(QPrivateSignal()); executed: self->aboutToQuit(QPrivateSignal()); Execution Count:62 | 62 |
570 | self->d_func()->aboutToQuitEmitted = true; | - |
571 | sendPostedEvents(0, QEvent::DeferredDelete); | - |
572 | } executed: } Execution Count:62 | 62 |
573 | | - |
574 | return returnCode; executed: return returnCode; Execution Count:62 | 62 |
575 | } | - |
576 | void QCoreApplication::exit(int returnCode) | - |
577 | { | - |
578 | if (!self) partially evaluated: !self no Evaluation Count:0 | yes Evaluation Count:64 |
| 0-64 |
579 | return; | 0 |
580 | QThreadData *data = self->d_func()->threadData; | - |
581 | data->quitNow = true; | - |
582 | for (int i = 0; i < data->eventLoops.size(); ++i) { evaluated: i < data->eventLoops.size() yes Evaluation Count:67 | yes Evaluation Count:64 |
| 64-67 |
583 | QEventLoop *eventLoop = data->eventLoops.at(i); | - |
584 | eventLoop->exit(returnCode); | - |
585 | } executed: } Execution Count:67 | 67 |
586 | } executed: } Execution Count:64 | 64 |
587 | void QCoreApplication::postEvent(QObject *receiver, QEvent *event, int priority) | - |
588 | { | - |
589 | if (receiver == 0) { partially evaluated: receiver == 0 no Evaluation Count:0 | yes Evaluation Count:432407 |
| 0-432407 |
590 | QMessageLogger("kernel/qcoreapplication.cpp", 1110, __PRETTY_FUNCTION__).warning("QCoreApplication::postEvent: Unexpected null receiver"); | - |
591 | delete event; | - |
592 | return; | 0 |
593 | } | - |
594 | | - |
595 | QThreadData * volatile * pdata = &receiver->d_func()->threadData; | - |
596 | QThreadData *data = *pdata; | - |
597 | if (!data) { partially evaluated: !data no Evaluation Count:0 | yes Evaluation Count:432408 |
| 0-432408 |
598 | | - |
599 | delete event; | - |
600 | return; | 0 |
601 | } | - |
602 | | - |
603 | | - |
604 | data->postEventList.mutex.lock(); | - |
605 | | - |
606 | | - |
607 | while (data != *pdata) { evaluated: data != *pdata yes Evaluation Count:6612 | yes Evaluation Count:432410 |
| 6612-432410 |
608 | data->postEventList.mutex.unlock(); | - |
609 | | - |
610 | data = *pdata; | - |
611 | if (!data) { partially evaluated: !data no Evaluation Count:0 | yes Evaluation Count:6612 |
| 0-6612 |
612 | | - |
613 | delete event; | - |
614 | return; | 0 |
615 | } | - |
616 | | - |
617 | data->postEventList.mutex.lock(); | - |
618 | } executed: } Execution Count:6612 | 6612 |
619 | | - |
620 | QMutexUnlocker locker(&data->postEventList.mutex); | - |
621 | | - |
622 | | - |
623 | if (receiver->d_func()->postedEvents evaluated: receiver->d_func()->postedEvents yes Evaluation Count:85952 | yes Evaluation Count:346457 |
| 85952-346457 |
624 | && self && self->compressEvent(event, receiver, &data->postEventList)) { partially evaluated: self yes Evaluation Count:85952 | no Evaluation Count:0 |
evaluated: self->compressEvent(event, receiver, &data->postEventList) yes Evaluation Count:5882 | yes Evaluation Count:80071 |
| 0-85952 |
625 | return; executed: return; Execution Count:5882 | 5882 |
626 | } | - |
627 | | - |
628 | if (event->type() == QEvent::DeferredDelete && data == QThreadData::current()) { evaluated: event->type() == QEvent::DeferredDelete yes Evaluation Count:7969 | yes Evaluation Count:418559 |
evaluated: data == QThreadData::current() yes Evaluation Count:7330 | yes Evaluation Count:639 |
| 639-418559 |
629 | | - |
630 | | - |
631 | static_cast<QDeferredDeleteEvent *>(event)->level = data->loopLevel; | - |
632 | } executed: } Execution Count:7330 | 7330 |
633 | | - |
634 | | - |
635 | | - |
636 | QScopedPointer<QEvent> eventDeleter(event); | - |
637 | data->postEventList.addEvent(QPostEvent(receiver, event, priority)); | - |
638 | eventDeleter.take(); | - |
639 | event->posted = true; | - |
640 | ++receiver->d_func()->postedEvents; | - |
641 | data->canWait = false; | - |
642 | locker.unlock(); | - |
643 | | - |
644 | if (data->eventDispatcher) evaluated: data->eventDispatcher yes Evaluation Count:426006 | yes Evaluation Count:520 |
| 520-426006 |
645 | data->eventDispatcher->wakeUp(); executed: data->eventDispatcher->wakeUp(); Execution Count:426006 | 426006 |
646 | } executed: } Execution Count:426527 | 426527 |
647 | | - |
648 | | - |
649 | | - |
650 | | - |
651 | | - |
652 | bool QCoreApplication::compressEvent(QEvent *event, QObject *receiver, QPostEventList *postedEvents) | - |
653 | { | - |
654 | if ((event->type() == QEvent::DeferredDelete evaluated: event->type() == QEvent::DeferredDelete yes Evaluation Count:118 | yes Evaluation Count:67351 |
| 118-67351 |
655 | || event->type() == QEvent::Quit) partially evaluated: event->type() == QEvent::Quit no Evaluation Count:0 | yes Evaluation Count:67352 |
| 0-67352 |
656 | && receiver->d_func()->postedEvents > 0) { partially evaluated: receiver->d_func()->postedEvents > 0 yes Evaluation Count:118 | no Evaluation Count:0 |
| 0-118 |
657 | for (int i = 0; i < postedEvents->size(); ++i) { evaluated: i < postedEvents->size() yes Evaluation Count:5135 | yes Evaluation Count:112 |
| 112-5135 |
658 | const QPostEvent &cur = postedEvents->at(i); | - |
659 | if (cur.receiver != receiver evaluated: cur.receiver != receiver yes Evaluation Count:4918 | yes Evaluation Count:217 |
| 217-4918 |
660 | || cur.event == 0 evaluated: cur.event == 0 yes Evaluation Count:7 | yes Evaluation Count:210 |
| 7-210 |
661 | || cur.event->type() != event->type()) evaluated: cur.event->type() != event->type() yes Evaluation Count:204 | yes Evaluation Count:6 |
| 6-204 |
662 | continue; executed: continue; Execution Count:5129 | 5129 |
663 | | - |
664 | delete event; | - |
665 | return true; executed: return true; Execution Count:6 | 6 |
666 | } | - |
667 | } executed: } Execution Count:112 | 112 |
668 | return false; executed: return false; Execution Count:67464 | 67464 |
669 | } | - |
670 | void QCoreApplication::sendPostedEvents(QObject *receiver, int event_type) | - |
671 | { | - |
672 | QThreadData *data = QThreadData::current(); | - |
673 | | - |
674 | QCoreApplicationPrivate::sendPostedEvents(receiver, event_type, data); | - |
675 | } executed: } Execution Count:2111080 | 2111080 |
676 | | - |
677 | void QCoreApplicationPrivate::sendPostedEvents(QObject *receiver, int event_type, | - |
678 | QThreadData *data) | - |
679 | { | - |
680 | if (event_type == -1) { partially evaluated: event_type == -1 no Evaluation Count:0 | yes Evaluation Count:2111054 |
| 0-2111054 |
681 | | - |
682 | event_type = 0; | - |
683 | } | 0 |
684 | | - |
685 | if (receiver && receiver->d_func()->threadData != data) { evaluated: receiver yes Evaluation Count:284 | yes Evaluation Count:2110769 |
partially evaluated: receiver->d_func()->threadData != data no Evaluation Count:0 | yes Evaluation Count:284 |
| 0-2110769 |
686 | QMessageLogger("kernel/qcoreapplication.cpp", 1240, __PRETTY_FUNCTION__).warning("QCoreApplication::sendPostedEvents: Cannot send " | - |
687 | "posted events for objects in another thread"); | - |
688 | return; | 0 |
689 | } | - |
690 | | - |
691 | ++data->postEventList.recursion; | - |
692 | | - |
693 | QMutexLocker locker(&data->postEventList.mutex); | - |
694 | | - |
695 | | - |
696 | | - |
697 | | - |
698 | data->canWait = (data->postEventList.size() == 0); | - |
699 | | - |
700 | if (data->postEventList.size() == 0 || (receiver && !receiver->d_func()->postedEvents)) { evaluated: data->postEventList.size() == 0 yes Evaluation Count:1791072 | yes Evaluation Count:320027 |
evaluated: receiver yes Evaluation Count:284 | yes Evaluation Count:319746 |
evaluated: !receiver->d_func()->postedEvents yes Evaluation Count:16 | yes Evaluation Count:268 |
| 16-1791072 |
701 | --data->postEventList.recursion; | - |
702 | return; executed: return; Execution Count:1791083 | 1791083 |
703 | } | - |
704 | | - |
705 | data->canWait = true; | - |
706 | | - |
707 | | - |
708 | | - |
709 | int startOffset = data->postEventList.startOffset; | - |
710 | int &i = (!event_type && !receiver) ? data->postEventList.startOffset : startOffset; evaluated: !event_type yes Evaluation Count:316233 | yes Evaluation Count:3783 |
evaluated: !receiver yes Evaluation Count:316222 | yes Evaluation Count:9 |
| 9-316233 |
711 | data->postEventList.insertionOffset = data->postEventList.size(); | - |
712 | | - |
713 | | - |
714 | struct CleanUp { | - |
715 | QObject *receiver; | - |
716 | int event_type; | - |
717 | QThreadData *data; | - |
718 | bool exceptionCaught; | - |
719 | | - |
720 | inline CleanUp(QObject *receiver, int event_type, QThreadData *data) : | - |
721 | receiver(receiver), event_type(event_type), data(data), exceptionCaught(true) | - |
722 | {} executed: } Execution Count:320008 | 320008 |
723 | inline ~CleanUp() | - |
724 | { | - |
725 | if (exceptionCaught) { partially evaluated: exceptionCaught no Evaluation Count:0 | yes Evaluation Count:320015 |
| 0-320015 |
726 | | - |
727 | data->canWait = false; | - |
728 | } | 0 |
729 | | - |
730 | --data->postEventList.recursion; | - |
731 | if (!data->postEventList.recursion && !data->canWait && data->eventDispatcher) evaluated: !data->postEventList.recursion yes Evaluation Count:319046 | yes Evaluation Count:968 |
evaluated: !data->canWait yes Evaluation Count:41869 | yes Evaluation Count:277181 |
partially evaluated: data->eventDispatcher yes Evaluation Count:41870 | no Evaluation Count:0 |
| 0-319046 |
732 | data->eventDispatcher->wakeUp(); executed: data->eventDispatcher->wakeUp(); Execution Count:41870 | 41870 |
733 | | - |
734 | | - |
735 | | - |
736 | if (!event_type && !receiver && data->postEventList.startOffset >= 0) { evaluated: !event_type yes Evaluation Count:316235 | yes Evaluation Count:3783 |
evaluated: !receiver yes Evaluation Count:316225 | yes Evaluation Count:9 |
partially evaluated: data->postEventList.startOffset >= 0 yes Evaluation Count:316225 | no Evaluation Count:0 |
| 0-316235 |
737 | const QPostEventList::iterator it = data->postEventList.begin(); | - |
738 | data->postEventList.erase(it, it + data->postEventList.startOffset); | - |
739 | data->postEventList.insertionOffset -= data->postEventList.startOffset; | - |
740 | qt_noop(); | - |
741 | data->postEventList.startOffset = 0; | - |
742 | } executed: } Execution Count:316218 | 316218 |
743 | } executed: } Execution Count:320010 | 320010 |
744 | }; | - |
745 | CleanUp cleanup(receiver, event_type, data); | - |
746 | | - |
747 | while (i < data->postEventList.size()) { evaluated: i < data->postEventList.size() yes Evaluation Count:770033 | yes Evaluation Count:277898 |
| 277898-770033 |
748 | | - |
749 | if (i >= data->postEventList.insertionOffset) evaluated: i >= data->postEventList.insertionOffset yes Evaluation Count:42122 | yes Evaluation Count:727982 |
| 42122-727982 |
750 | break; executed: break; Execution Count:42122 | 42122 |
751 | | - |
752 | const QPostEvent &pe = data->postEventList.at(i); | - |
753 | ++i; | - |
754 | | - |
755 | if (!pe.event) evaluated: !pe.event yes Evaluation Count:353865 | yes Evaluation Count:374643 |
| 353865-374643 |
756 | continue; executed: continue; Execution Count:353867 | 353867 |
757 | if ((receiver && receiver != pe.receiver) || (event_type && event_type != pe.event->type())) { evaluated: receiver yes Evaluation Count:2259 | yes Evaluation Count:372387 |
evaluated: receiver != pe.receiver yes Evaluation Count:1752 | yes Evaluation Count:507 |
evaluated: event_type yes Evaluation Count:907 | yes Evaluation Count:371986 |
evaluated: event_type != pe.event->type() yes Evaluation Count:461 | yes Evaluation Count:446 |
| 446-372387 |
758 | data->canWait = false; | - |
759 | continue; executed: continue; Execution Count:2213 | 2213 |
760 | } | - |
761 | | - |
762 | if (pe.event->type() == QEvent::DeferredDelete) { evaluated: pe.event->type() == QEvent::DeferredDelete yes Evaluation Count:3244 | yes Evaluation Count:369192 |
| 3244-369192 |
763 | | - |
764 | | - |
765 | | - |
766 | int loopLevel = static_cast<QDeferredDeleteEvent *>(pe.event)->loopLevel(); | - |
767 | const bool allowDeferredDelete = | - |
768 | (loopLevel > data->loopLevel evaluated: loopLevel > data->loopLevel yes Evaluation Count:1684 | yes Evaluation Count:1560 |
| 1560-1684 |
769 | || (!loopLevel && data->loopLevel > 0) evaluated: !loopLevel yes Evaluation Count:1547 | yes Evaluation Count:13 |
evaluated: data->loopLevel > 0 yes Evaluation Count:663 | yes Evaluation Count:884 |
| 13-1547 |
770 | || (event_type == QEvent::DeferredDelete evaluated: event_type == QEvent::DeferredDelete yes Evaluation Count:260 | yes Evaluation Count:637 |
| 260-637 |
771 | && loopLevel == data->loopLevel)); evaluated: loopLevel == data->loopLevel yes Evaluation Count:259 | yes Evaluation Count:1 |
| 1-259 |
772 | if (!allowDeferredDelete) { evaluated: !allowDeferredDelete yes Evaluation Count:638 | yes Evaluation Count:2606 |
| 638-2606 |
773 | | - |
774 | if (!event_type && !receiver) { evaluated: !event_type yes Evaluation Count:637 | yes Evaluation Count:1 |
partially evaluated: !receiver yes Evaluation Count:637 | no Evaluation Count:0 |
| 0-637 |
775 | | - |
776 | | - |
777 | | - |
778 | | - |
779 | QPostEvent pe_copy = pe; | - |
780 | | - |
781 | | - |
782 | | - |
783 | const_cast<QPostEvent &>(pe).event = 0; | - |
784 | | - |
785 | | - |
786 | data->postEventList.addEvent(pe_copy); | - |
787 | } executed: } Execution Count:637 | 637 |
788 | continue; executed: continue; Execution Count:638 | 638 |
789 | } | - |
790 | } executed: } Execution Count:2606 | 2606 |
791 | | - |
792 | | - |
793 | | - |
794 | pe.event->posted = false; | - |
795 | QScopedPointer<QEvent> e(pe.event); | - |
796 | QObject * r = pe.receiver; | - |
797 | | - |
798 | --r->d_func()->postedEvents; | - |
799 | qt_noop(); | - |
800 | | - |
801 | | - |
802 | | - |
803 | const_cast<QPostEvent &>(pe).event = 0; | - |
804 | | - |
805 | struct MutexUnlocker | - |
806 | { | - |
807 | QMutexLocker &m; | - |
808 | MutexUnlocker(QMutexLocker &m) : m(m) { m.unlock(); } executed: } Execution Count:371790 | 371790 |
809 | ~MutexUnlocker() { m.relock(); } executed: } Execution Count:371773 | 371773 |
810 | }; | - |
811 | MutexUnlocker unlocker(locker); | - |
812 | | - |
813 | | - |
814 | QCoreApplication::sendEvent(r, e.data()); | - |
815 | | - |
816 | | - |
817 | | - |
818 | | - |
819 | } executed: } Execution Count:371758 | 371758 |
820 | | - |
821 | cleanup.exceptionCaught = false; | - |
822 | } executed: } Execution Count:320017 | 320017 |
823 | void QCoreApplication::removePostedEvents(QObject *receiver, int eventType) | - |
824 | { | - |
825 | QThreadData *data = receiver ? receiver->d_func()->threadData : QThreadData::current(); evaluated: receiver yes Evaluation Count:42210 | yes Evaluation Count:2 |
| 2-42210 |
826 | QMutexLocker locker(&data->postEventList.mutex); | - |
827 | | - |
828 | | - |
829 | | - |
830 | | - |
831 | | - |
832 | if (receiver && !receiver->d_func()->postedEvents) evaluated: receiver yes Evaluation Count:42210 | yes Evaluation Count:2 |
evaluated: !receiver->d_func()->postedEvents yes Evaluation Count:10531 | yes Evaluation Count:31679 |
| 2-42210 |
833 | return; executed: return; Execution Count:10531 | 10531 |
834 | | - |
835 | | - |
836 | | - |
837 | QVarLengthArray<QEvent*> events; | - |
838 | int n = data->postEventList.size(); | - |
839 | int j = 0; | - |
840 | | - |
841 | for (int i = 0; i < n; ++i) { evaluated: i < n yes Evaluation Count:1276716 | yes Evaluation Count:31681 |
| 31681-1276716 |
842 | const QPostEvent &pe = data->postEventList.at(i); | - |
843 | | - |
844 | if ((!receiver || pe.receiver == receiver) evaluated: !receiver yes Evaluation Count:12 | yes Evaluation Count:1276704 |
evaluated: pe.receiver == receiver yes Evaluation Count:48981 | yes Evaluation Count:1227723 |
| 12-1276704 |
845 | && (pe.event && (eventType == 0 || pe.event->type() == eventType))) { evaluated: pe.event yes Evaluation Count:48896 | yes Evaluation Count:97 |
evaluated: eventType == 0 yes Evaluation Count:48634 | yes Evaluation Count:262 |
evaluated: pe.event->type() == eventType yes Evaluation Count:151 | yes Evaluation Count:111 |
| 97-48896 |
846 | --pe.receiver->d_func()->postedEvents; | - |
847 | pe.event->posted = false; | - |
848 | events.append(pe.event); | - |
849 | const_cast<QPostEvent &>(pe).event = 0; | - |
850 | } else if (!data->postEventList.recursion) { executed: } Execution Count:48785 evaluated: !data->postEventList.recursion yes Evaluation Count:1227678 | yes Evaluation Count:253 |
| 253-1227678 |
851 | if (i != j) evaluated: i != j yes Evaluation Count:681938 | yes Evaluation Count:545740 |
| 545740-681938 |
852 | qSwap(data->postEventList[i], data->postEventList[j]); executed: qSwap(data->postEventList[i], data->postEventList[j]); Execution Count:681938 | 681938 |
853 | ++j; | - |
854 | } executed: } Execution Count:1227678 | 1227678 |
855 | } | - |
856 | | - |
857 | | - |
858 | | - |
859 | | - |
860 | | - |
861 | | - |
862 | | - |
863 | if (!data->postEventList.recursion) { evaluated: !data->postEventList.recursion yes Evaluation Count:31517 | yes Evaluation Count:164 |
| 164-31517 |
864 | | - |
865 | data->postEventList.erase(data->postEventList.begin() + j, data->postEventList.end()); | - |
866 | } executed: } Execution Count:31517 | 31517 |
867 | | - |
868 | locker.unlock(); | - |
869 | for (int i = 0; i < events.count(); ++i) { evaluated: i < events.count() yes Evaluation Count:48785 | yes Evaluation Count:31681 |
| 31681-48785 |
870 | delete events[i]; | - |
871 | } executed: } Execution Count:48785 | 48785 |
872 | } executed: } Execution Count:31681 | 31681 |
873 | void QCoreApplicationPrivate::removePostedEvent(QEvent * event) | - |
874 | { | - |
875 | if (!event || !event->posted) never evaluated: !event->posted | 0 |
876 | return; | 0 |
877 | | - |
878 | QThreadData *data = QThreadData::current(); | - |
879 | | - |
880 | QMutexLocker locker(&data->postEventList.mutex); | - |
881 | | - |
882 | if (data->postEventList.size() == 0) { never evaluated: data->postEventList.size() == 0 | 0 |
883 | | - |
884 | | - |
885 | | - |
886 | | - |
887 | | - |
888 | } | 0 |
889 | | - |
890 | for (int i = 0; i < data->postEventList.size(); ++i) { never evaluated: i < data->postEventList.size() | 0 |
891 | const QPostEvent & pe = data->postEventList.at(i); | - |
892 | if (pe.event == event) { never evaluated: pe.event == event | 0 |
893 | | - |
894 | | - |
895 | | - |
896 | | - |
897 | | - |
898 | | - |
899 | --pe.receiver->d_func()->postedEvents; | - |
900 | pe.event->posted = false; | - |
901 | delete pe.event; | - |
902 | const_cast<QPostEvent &>(pe).event = 0; | - |
903 | return; | 0 |
904 | } | - |
905 | } | 0 |
906 | } | 0 |
907 | | - |
908 | | - |
909 | | - |
910 | | - |
911 | bool QCoreApplication::event(QEvent *e) | - |
912 | { | - |
913 | if (e->type() == QEvent::Quit) { evaluated: e->type() == QEvent::Quit yes Evaluation Count:12 | yes Evaluation Count:1493 |
| 12-1493 |
914 | quit(); | - |
915 | return true; executed: return true; Execution Count:12 | 12 |
916 | } | - |
917 | return QObject::event(e); executed: return QObject::event(e); Execution Count:1493 | 1493 |
918 | } | - |
919 | void QCoreApplicationPrivate::ref() | - |
920 | { | - |
921 | quitLockRef.ref(); | - |
922 | } executed: } Execution Count:6 | 6 |
923 | | - |
924 | void QCoreApplicationPrivate::deref() | - |
925 | { | - |
926 | if (!quitLockRef.deref()) evaluated: !quitLockRef.deref() yes Evaluation Count:1 | yes Evaluation Count:5 |
| 1-5 |
927 | maybeQuit(); executed: maybeQuit(); Execution Count:1 | 1 |
928 | } executed: } Execution Count:6 | 6 |
929 | | - |
930 | void QCoreApplicationPrivate::maybeQuit() | - |
931 | { | - |
932 | if (quitLockRef.load() == 0 && in_exec && quitLockRefEnabled && shouldQuit()) partially evaluated: quitLockRef.load() == 0 yes Evaluation Count:972 | no Evaluation Count:0 |
evaluated: in_exec yes Evaluation Count:17 | yes Evaluation Count:955 |
partially evaluated: quitLockRefEnabled yes Evaluation Count:17 | no Evaluation Count:0 |
evaluated: shouldQuit() yes Evaluation Count:15 | yes Evaluation Count:2 |
| 0-972 |
933 | QCoreApplication::postEvent(QCoreApplication::instance(), new QEvent(QEvent::Quit)); executed: QCoreApplication::postEvent(QCoreApplication::instance(), new QEvent(QEvent::Quit)); Execution Count:15 | 15 |
934 | } executed: } Execution Count:972 | 972 |
935 | void QCoreApplication::quit() | - |
936 | { | - |
937 | exit(0); executed: exit(0); Execution Count:62 | 62 |
938 | } | - |
939 | bool QCoreApplication::installTranslator(QTranslator *translationFile) | - |
940 | { | - |
941 | if (!translationFile) partially evaluated: !translationFile no Evaluation Count:0 | yes Evaluation Count:31 |
| 0-31 |
942 | return false; never executed: return false; | 0 |
943 | | - |
944 | if (!QCoreApplicationPrivate::checkInstance("installTranslator")) partially evaluated: !QCoreApplicationPrivate::checkInstance("installTranslator") no Evaluation Count:0 | yes Evaluation Count:31 |
| 0-31 |
945 | return false; never executed: return false; | 0 |
946 | QCoreApplicationPrivate *d = self->d_func(); | - |
947 | d->translators.prepend(translationFile); | - |
948 | | - |
949 | | - |
950 | if (translationFile->isEmpty()) evaluated: translationFile->isEmpty() yes Evaluation Count:1 | yes Evaluation Count:30 |
| 1-30 |
951 | return false; executed: return false; Execution Count:1 | 1 |
952 | | - |
953 | | - |
954 | QEvent ev(QEvent::LanguageChange); | - |
955 | QCoreApplication::sendEvent(self, &ev); | - |
956 | return true; executed: return true; Execution Count:30 | 30 |
957 | } | - |
958 | bool QCoreApplication::removeTranslator(QTranslator *translationFile) | - |
959 | { | - |
960 | if (!translationFile) partially evaluated: !translationFile no Evaluation Count:0 | yes Evaluation Count:42 |
| 0-42 |
961 | return false; never executed: return false; | 0 |
962 | if (!QCoreApplicationPrivate::checkInstance("removeTranslator")) partially evaluated: !QCoreApplicationPrivate::checkInstance("removeTranslator") no Evaluation Count:0 | yes Evaluation Count:42 |
| 0-42 |
963 | return false; never executed: return false; | 0 |
964 | QCoreApplicationPrivate *d = self->d_func(); | - |
965 | if (d->translators.removeAll(translationFile)) { evaluated: d->translators.removeAll(translationFile) yes Evaluation Count:31 | yes Evaluation Count:11 |
| 11-31 |
966 | if (!self->closingDown()) { partially evaluated: !self->closingDown() yes Evaluation Count:31 | no Evaluation Count:0 |
| 0-31 |
967 | QEvent ev(QEvent::LanguageChange); | - |
968 | QCoreApplication::sendEvent(self, &ev); | - |
969 | } executed: } Execution Count:31 | 31 |
970 | return true; executed: return true; Execution Count:31 | 31 |
971 | } | - |
972 | return false; executed: return false; Execution Count:11 | 11 |
973 | } | - |
974 | | - |
975 | static void replacePercentN(QString *result, int n) | - |
976 | { | - |
977 | if (n >= 0) { evaluated: n >= 0 yes Evaluation Count:6 | yes Evaluation Count:284885 |
| 6-284885 |
978 | int percentPos = 0; | - |
979 | int len = 0; | - |
980 | while ((percentPos = result->indexOf(QLatin1Char('%'), percentPos + len)) != -1) { evaluated: (percentPos = result->indexOf(QLatin1Char('%'), percentPos + len)) != -1 yes Evaluation Count:6 | yes Evaluation Count:6 |
| 6 |
981 | len = 1; | - |
982 | QString fmt; | - |
983 | if (result->at(percentPos + len) == QLatin1Char('L')) { partially evaluated: result->at(percentPos + len) == QLatin1Char('L') no Evaluation Count:0 | yes Evaluation Count:6 |
| 0-6 |
984 | ++len; | - |
985 | fmt = QLatin1String("%L1"); | - |
986 | } else { | 0 |
987 | fmt = QLatin1String("%1"); | - |
988 | } executed: } Execution Count:6 | 6 |
989 | if (result->at(percentPos + len) == QLatin1Char('n')) { partially evaluated: result->at(percentPos + len) == QLatin1Char('n') yes Evaluation Count:6 | no Evaluation Count:0 |
| 0-6 |
990 | fmt = fmt.arg(n); | - |
991 | ++len; | - |
992 | result->replace(percentPos, len, fmt); | - |
993 | len = fmt.length(); | - |
994 | } executed: } Execution Count:6 | 6 |
995 | } executed: } Execution Count:6 | 6 |
996 | } executed: } Execution Count:6 | 6 |
997 | } executed: } Execution Count:284891 | 284891 |
998 | QString QCoreApplication::translate(const char *context, const char *sourceText, | - |
999 | const char *disambiguation, int n) | - |
1000 | { | - |
1001 | QString result; | - |
1002 | | - |
1003 | if (!sourceText) evaluated: !sourceText yes Evaluation Count:4 | yes Evaluation Count:284891 |
| 4-284891 |
1004 | return result; executed: return result; Execution Count:4 | 4 |
1005 | | - |
1006 | if (self && !self->d_func()->translators.isEmpty()) { evaluated: self yes Evaluation Count:284890 | yes Evaluation Count:1 |
evaluated: !self->d_func()->translators.isEmpty() yes Evaluation Count:183 | yes Evaluation Count:284707 |
| 1-284890 |
1007 | QList<QTranslator*>::ConstIterator it; | - |
1008 | QTranslator *translationFile; | - |
1009 | for (it = self->d_func()->translators.constBegin(); it != self->d_func()->translators.constEnd(); ++it) { evaluated: it != self->d_func()->translators.constEnd() yes Evaluation Count:208 | yes Evaluation Count:46 |
| 46-208 |
1010 | translationFile = *it; | - |
1011 | result = translationFile->translate(context, sourceText, disambiguation, n); | - |
1012 | if (!result.isNull()) evaluated: !result.isNull() yes Evaluation Count:137 | yes Evaluation Count:71 |
| 71-137 |
1013 | break; executed: break; Execution Count:137 | 137 |
1014 | } executed: } Execution Count:71 | 71 |
1015 | } executed: } Execution Count:183 | 183 |
1016 | | - |
1017 | if (result.isNull()) evaluated: result.isNull() yes Evaluation Count:284754 | yes Evaluation Count:137 |
| 137-284754 |
1018 | result = QString::fromUtf8(sourceText); executed: result = QString::fromUtf8(sourceText); Execution Count:284754 | 284754 |
1019 | | - |
1020 | replacePercentN(&result, n); | - |
1021 | return result; executed: return result; Execution Count:284891 | 284891 |
1022 | } | - |
1023 | | - |
1024 | | - |
1025 | | - |
1026 | | - |
1027 | | - |
1028 | | - |
1029 | | - |
1030 | QString qtTrId(const char *id, int n) | - |
1031 | { | - |
1032 | return QCoreApplication::translate(0, id, 0, n); never executed: return QCoreApplication::translate(0, id, 0, n); | 0 |
1033 | } | - |
1034 | | - |
1035 | bool QCoreApplicationPrivate::isTranslatorInstalled(QTranslator *translator) | - |
1036 | { | - |
1037 | return QCoreApplication::self | 34 |
1038 | && QCoreApplication::self->d_func()->translators.contains(translator); executed: return QCoreApplication::self && QCoreApplication::self->d_func()->translators.contains(translator); Execution Count:34 | 34 |
1039 | } | - |
1040 | QString QCoreApplication::applicationDirPath() | - |
1041 | { | - |
1042 | if (!self) { partially evaluated: !self no Evaluation Count:0 | yes Evaluation Count:502 |
| 0-502 |
1043 | QMessageLogger("kernel/qcoreapplication.cpp", 1775, __PRETTY_FUNCTION__).warning("QCoreApplication::applicationDirPath: Please instantiate the QApplication object first"); | - |
1044 | return QString(); never executed: return QString(); | 0 |
1045 | } | - |
1046 | | - |
1047 | QCoreApplicationPrivate *d = self->d_func(); | - |
1048 | if (d->cachedApplicationDirPath.isNull()) evaluated: d->cachedApplicationDirPath.isNull() yes Evaluation Count:58 | yes Evaluation Count:444 |
| 58-444 |
1049 | d->cachedApplicationDirPath = QFileInfo(applicationFilePath()).path(); executed: d->cachedApplicationDirPath = QFileInfo(applicationFilePath()).path(); Execution Count:58 | 58 |
1050 | return d->cachedApplicationDirPath; executed: return d->cachedApplicationDirPath; Execution Count:502 | 502 |
1051 | } | - |
1052 | QString QCoreApplication::applicationFilePath() | - |
1053 | { | - |
1054 | if (!self) { partially evaluated: !self no Evaluation Count:0 | yes Evaluation Count:93 |
| 0-93 |
1055 | QMessageLogger("kernel/qcoreapplication.cpp", 1803, __PRETTY_FUNCTION__).warning("QCoreApplication::applicationFilePath: Please instantiate the QApplication object first"); | - |
1056 | return QString(); never executed: return QString(); | 0 |
1057 | } | - |
1058 | | - |
1059 | QCoreApplicationPrivate *d = self->d_func(); | - |
1060 | if (!d->cachedApplicationFilePath.isNull()) evaluated: !d->cachedApplicationFilePath.isNull() yes Evaluation Count:34 | yes Evaluation Count:59 |
| 34-59 |
1061 | return d->cachedApplicationFilePath; executed: return d->cachedApplicationFilePath; Execution Count:34 | 34 |
1062 | QFileInfo pfi(QString::fromLatin1("/proc/%1/exe").arg(getpid())); | - |
1063 | if (pfi.exists() && pfi.isSymLink()) { partially evaluated: pfi.exists() yes Evaluation Count:59 | no Evaluation Count:0 |
partially evaluated: pfi.isSymLink() yes Evaluation Count:59 | no Evaluation Count:0 |
| 0-59 |
1064 | d->cachedApplicationFilePath = pfi.canonicalFilePath(); | - |
1065 | return d->cachedApplicationFilePath; executed: return d->cachedApplicationFilePath; Execution Count:59 | 59 |
1066 | } | - |
1067 | | - |
1068 | | - |
1069 | QString argv0 = QFile::decodeName(arguments().at(0).toLocal8Bit()); | - |
1070 | QString absPath; | - |
1071 | | - |
1072 | if (!argv0.isEmpty() && argv0.at(0) == QLatin1Char('/')) { never evaluated: !argv0.isEmpty() never evaluated: argv0.at(0) == QLatin1Char('/') | 0 |
1073 | | - |
1074 | | - |
1075 | | - |
1076 | | - |
1077 | absPath = argv0; | - |
1078 | } else if (argv0.contains(QLatin1Char('/'))) { never evaluated: argv0.contains(QLatin1Char('/')) | 0 |
1079 | | - |
1080 | | - |
1081 | | - |
1082 | | - |
1083 | absPath = QDir::current().absoluteFilePath(argv0); | - |
1084 | } else { | 0 |
1085 | | - |
1086 | | - |
1087 | | - |
1088 | | - |
1089 | absPath = QStandardPaths::findExecutable(argv0); | - |
1090 | } | 0 |
1091 | | - |
1092 | absPath = QDir::cleanPath(absPath); | - |
1093 | | - |
1094 | QFileInfo fi(absPath); | - |
1095 | d->cachedApplicationFilePath = fi.exists() ? fi.canonicalFilePath() : QString(); never evaluated: fi.exists() | 0 |
1096 | return d->cachedApplicationFilePath; never executed: return d->cachedApplicationFilePath; | 0 |
1097 | | - |
1098 | } | - |
1099 | | - |
1100 | | - |
1101 | | - |
1102 | | - |
1103 | | - |
1104 | | - |
1105 | qint64 QCoreApplication::applicationPid() | - |
1106 | { | - |
1107 | | - |
1108 | | - |
1109 | | - |
1110 | | - |
1111 | | - |
1112 | return getpid(); executed: return getpid(); Execution Count:1480 | 1480 |
1113 | | - |
1114 | } | - |
1115 | QStringList QCoreApplication::arguments() | - |
1116 | { | - |
1117 | QStringList list; | - |
1118 | | - |
1119 | if (!self) { partially evaluated: !self no Evaluation Count:0 | yes Evaluation Count:4 |
| 0-4 |
1120 | QMessageLogger("kernel/qcoreapplication.cpp", 1945, __PRETTY_FUNCTION__).warning("QCoreApplication::arguments: Please instantiate the QApplication object first"); | - |
1121 | return list; never executed: return list; | 0 |
1122 | } | - |
1123 | const int ac = self->d_func()->argc; | - |
1124 | char ** const av = self->d_func()->argv; | - |
1125 | list.reserve(ac); | - |
1126 | for (int a = 0; a < ac; ++a) { evaluated: a < ac yes Evaluation Count:6 | yes Evaluation Count:4 |
| 4-6 |
1127 | list << QString::fromLocal8Bit(av[a]); | - |
1128 | } executed: } Execution Count:6 | 6 |
1129 | | - |
1130 | | - |
1131 | return list; executed: return list; Execution Count:4 | 4 |
1132 | } | - |
1133 | void QCoreApplication::setOrganizationName(const QString &orgName) | - |
1134 | { | - |
1135 | coreappdata()->orgName = orgName; | - |
1136 | } executed: } Execution Count:5 | 5 |
1137 | | - |
1138 | QString QCoreApplication::organizationName() | - |
1139 | { | - |
1140 | | - |
1141 | | - |
1142 | | - |
1143 | return coreappdata()->orgName; executed: return coreappdata()->orgName; Execution Count:22 | 22 |
1144 | } | - |
1145 | void QCoreApplication::setOrganizationDomain(const QString &orgDomain) | - |
1146 | { | - |
1147 | coreappdata()->orgDomain = orgDomain; | - |
1148 | } | 0 |
1149 | | - |
1150 | QString QCoreApplication::organizationDomain() | - |
1151 | { | - |
1152 | return coreappdata()->orgDomain; executed: return coreappdata()->orgDomain; Execution Count:5 | 5 |
1153 | } | - |
1154 | void QCoreApplication::setApplicationName(const QString &application) | - |
1155 | { | - |
1156 | coreappdata()->application = application; | - |
1157 | } executed: } Execution Count:17 | 17 |
1158 | | - |
1159 | QString QCoreApplication::applicationName() | - |
1160 | { | - |
1161 | | - |
1162 | | - |
1163 | | - |
1164 | QString appname = coreappdata() ? coreappdata()->application : QString(); partially evaluated: coreappdata() yes Evaluation Count:5402 | no Evaluation Count:0 |
| 0-5402 |
1165 | if (appname.isEmpty() && QCoreApplication::self) evaluated: appname.isEmpty() yes Evaluation Count:3322 | yes Evaluation Count:2080 |
partially evaluated: QCoreApplication::self yes Evaluation Count:3322 | no Evaluation Count:0 |
| 0-3322 |
1166 | appname = QCoreApplication::self->d_func()->appName(); executed: appname = QCoreApplication::self->d_func()->appName(); Execution Count:3322 | 3322 |
1167 | return appname; executed: return appname; Execution Count:5402 | 5402 |
1168 | } | - |
1169 | | - |
1170 | | - |
1171 | __attribute__((visibility("default"))) QString qt_applicationName_noFallback() | - |
1172 | { | - |
1173 | return coreappdata()->application; executed: return coreappdata()->application; Execution Count:2 | 2 |
1174 | } | - |
1175 | void QCoreApplication::setApplicationVersion(const QString &version) | - |
1176 | { | - |
1177 | coreappdata()->applicationVersion = version; | - |
1178 | } executed: } Execution Count:2 | 2 |
1179 | | - |
1180 | QString QCoreApplication::applicationVersion() | - |
1181 | { | - |
1182 | | - |
1183 | | - |
1184 | | - |
1185 | return coreappdata()->applicationVersion; executed: return coreappdata()->applicationVersion; Execution Count:4 | 4 |
1186 | } | - |
1187 | | - |
1188 | | - |
1189 | | - |
1190 | static QMutex *libraryPathMutex() { static QGlobalStatic<QMutex > thisGlobalStatic = { { (0) }, false }; if (!thisGlobalStatic.pointer.load() && !thisGlobalStatic.destroyed) { QMutex *x = new QMutex (QMutex::Recursive); if (!thisGlobalStatic.pointer.testAndSetOrdered(0, x)) delete x; else static QGlobalStaticDeleter<QMutex > cleanup(thisGlobalStatic); } return thisGlobalStatic.pointer.load(); } never executed: delete x; executed: return thisGlobalStatic.pointer.load(); Execution Count:157 partially evaluated: !thisGlobalStatic.pointer.testAndSetOrdered(0, x) no Evaluation Count:0 | yes Evaluation Count:22 |
evaluated: !thisGlobalStatic.pointer.load() yes Evaluation Count:22 | yes Evaluation Count:135 |
partially evaluated: !thisGlobalStatic.destroyed yes Evaluation Count:22 | no Evaluation Count:0 |
| 0-157 |
1191 | QStringList QCoreApplication::libraryPaths() | - |
1192 | { | - |
1193 | QMutexLocker locker(libraryPathMutex()); | - |
1194 | if (!coreappdata()->app_libpaths) { evaluated: !coreappdata()->app_libpaths yes Evaluation Count:27 | yes Evaluation Count:120 |
| 27-120 |
1195 | QStringList *app_libpaths = coreappdata()->app_libpaths = new QStringList; | - |
1196 | QString installPathPlugins = QLibraryInfo::location(QLibraryInfo::PluginsPath); | - |
1197 | if (QFile::exists(installPathPlugins)) { partially evaluated: QFile::exists(installPathPlugins) yes Evaluation Count:27 | no Evaluation Count:0 |
| 0-27 |
1198 | | - |
1199 | installPathPlugins = QDir(installPathPlugins).canonicalPath(); | - |
1200 | if (!app_libpaths->contains(installPathPlugins)) partially evaluated: !app_libpaths->contains(installPathPlugins) yes Evaluation Count:27 | no Evaluation Count:0 |
| 0-27 |
1201 | app_libpaths->append(installPathPlugins); executed: app_libpaths->append(installPathPlugins); Execution Count:27 | 27 |
1202 | } executed: } Execution Count:27 | 27 |
1203 | | - |
1204 | | - |
1205 | | - |
1206 | if (self) self->d_func()->appendApplicationPathToLibraryPaths(); executed: self->d_func()->appendApplicationPathToLibraryPaths(); Execution Count:26 evaluated: self yes Evaluation Count:26 | yes Evaluation Count:1 |
| 1-26 |
1207 | | - |
1208 | const QByteArray libPathEnv = qgetenv("QT_PLUGIN_PATH"); | - |
1209 | if (!libPathEnv.isEmpty()) { evaluated: !libPathEnv.isEmpty() yes Evaluation Count:3 | yes Evaluation Count:24 |
| 3-24 |
1210 | | - |
1211 | | - |
1212 | | - |
1213 | QLatin1Char pathSep(':'); | - |
1214 | | - |
1215 | QStringList paths = QFile::decodeName(libPathEnv).split(pathSep, QString::SkipEmptyParts); | - |
1216 | for (QStringList::const_iterator it = paths.constBegin(); it != paths.constEnd(); ++it) { evaluated: it != paths.constEnd() yes Evaluation Count:5 | yes Evaluation Count:3 |
| 3-5 |
1217 | QString canonicalPath = QDir(*it).canonicalPath(); | - |
1218 | if (!canonicalPath.isEmpty() evaluated: !canonicalPath.isEmpty() yes Evaluation Count:3 | yes Evaluation Count:2 |
| 2-3 |
1219 | && !app_libpaths->contains(canonicalPath)) { evaluated: !app_libpaths->contains(canonicalPath) yes Evaluation Count:2 | yes Evaluation Count:1 |
| 1-2 |
1220 | app_libpaths->append(canonicalPath); | - |
1221 | } executed: } Execution Count:2 | 2 |
1222 | } executed: } Execution Count:5 | 5 |
1223 | } executed: } Execution Count:3 | 3 |
1224 | } executed: } Execution Count:27 | 27 |
1225 | return *(coreappdata()->app_libpaths); executed: return *(coreappdata()->app_libpaths); Execution Count:147 | 147 |
1226 | } | - |
1227 | void QCoreApplication::setLibraryPaths(const QStringList &paths) | - |
1228 | { | - |
1229 | QMutexLocker locker(libraryPathMutex()); | - |
1230 | if (!coreappdata()->app_libpaths) evaluated: !coreappdata()->app_libpaths yes Evaluation Count:2 | yes Evaluation Count:1 |
| 1-2 |
1231 | coreappdata()->app_libpaths = new QStringList; executed: coreappdata()->app_libpaths = new QStringList; Execution Count:2 | 2 |
1232 | *(coreappdata()->app_libpaths) = paths; | - |
1233 | locker.unlock(); | - |
1234 | QFactoryLoader::refreshAll(); | - |
1235 | } executed: } Execution Count:3 | 3 |
1236 | void QCoreApplication::addLibraryPath(const QString &path) | - |
1237 | { | - |
1238 | if (path.isEmpty()) partially evaluated: path.isEmpty() no Evaluation Count:0 | yes Evaluation Count:7 |
| 0-7 |
1239 | return; | 0 |
1240 | | - |
1241 | QMutexLocker locker(libraryPathMutex()); | - |
1242 | | - |
1243 | | - |
1244 | libraryPaths(); | - |
1245 | | - |
1246 | QString canonicalPath = QDir(path).canonicalPath(); | - |
1247 | if (!canonicalPath.isEmpty() partially evaluated: !canonicalPath.isEmpty() yes Evaluation Count:7 | no Evaluation Count:0 |
| 0-7 |
1248 | && !coreappdata()->app_libpaths->contains(canonicalPath)) { evaluated: !coreappdata()->app_libpaths->contains(canonicalPath) yes Evaluation Count:3 | yes Evaluation Count:4 |
| 3-4 |
1249 | coreappdata()->app_libpaths->prepend(canonicalPath); | - |
1250 | locker.unlock(); | - |
1251 | QFactoryLoader::refreshAll(); | - |
1252 | } executed: } Execution Count:3 | 3 |
1253 | } executed: } Execution Count:7 | 7 |
1254 | | - |
1255 | | - |
1256 | | - |
1257 | | - |
1258 | | - |
1259 | | - |
1260 | | - |
1261 | void QCoreApplication::removeLibraryPath(const QString &path) | - |
1262 | { | - |
1263 | if (path.isEmpty()) never evaluated: path.isEmpty() | 0 |
1264 | return; | 0 |
1265 | | - |
1266 | QMutexLocker locker(libraryPathMutex()); | - |
1267 | | - |
1268 | | - |
1269 | libraryPaths(); | - |
1270 | | - |
1271 | QString canonicalPath = QDir(path).canonicalPath(); | - |
1272 | coreappdata()->app_libpaths->removeAll(canonicalPath); | - |
1273 | QFactoryLoader::refreshAll(); | - |
1274 | } | 0 |
1275 | void QCoreApplication::installNativeEventFilter(QAbstractNativeEventFilter *filterObj) | - |
1276 | { | - |
1277 | QAbstractEventDispatcher *eventDispatcher = QAbstractEventDispatcher::instance(QCoreApplicationPrivate::theMainThread); | - |
1278 | if (!filterObj || !eventDispatcher) never evaluated: !filterObj never evaluated: !eventDispatcher | 0 |
1279 | return; | 0 |
1280 | eventDispatcher->installNativeEventFilter(filterObj); | - |
1281 | } | 0 |
1282 | void QCoreApplication::removeNativeEventFilter(QAbstractNativeEventFilter *filterObject) | - |
1283 | { | - |
1284 | QAbstractEventDispatcher *eventDispatcher = QAbstractEventDispatcher::instance(); | - |
1285 | if (!filterObject || !eventDispatcher) never evaluated: !filterObject never evaluated: !eventDispatcher | 0 |
1286 | return; | 0 |
1287 | eventDispatcher->removeNativeEventFilter(filterObject); | - |
1288 | } | 0 |
1289 | bool QCoreApplication::hasPendingEvents() | - |
1290 | { | - |
1291 | QAbstractEventDispatcher *eventDispatcher = QAbstractEventDispatcher::instance(); | - |
1292 | if (eventDispatcher) never evaluated: eventDispatcher | 0 |
1293 | return eventDispatcher->hasPendingEvents(); never executed: return eventDispatcher->hasPendingEvents(); | 0 |
1294 | return false; never executed: return false; | 0 |
1295 | } | - |
1296 | | - |
1297 | | - |
1298 | | - |
1299 | | - |
1300 | | - |
1301 | QAbstractEventDispatcher *QCoreApplication::eventDispatcher() | - |
1302 | { | - |
1303 | if (QCoreApplicationPrivate::theMainThread) partially evaluated: QCoreApplicationPrivate::theMainThread yes Evaluation Count:3 | no Evaluation Count:0 |
| 0-3 |
1304 | return QCoreApplicationPrivate::theMainThread->eventDispatcher(); executed: return QCoreApplicationPrivate::theMainThread->eventDispatcher(); Execution Count:3 | 3 |
1305 | return 0; never executed: return 0; | 0 |
1306 | } | - |
1307 | | - |
1308 | | - |
1309 | | - |
1310 | | - |
1311 | | - |
1312 | | - |
1313 | | - |
1314 | void QCoreApplication::setEventDispatcher(QAbstractEventDispatcher *eventDispatcher) | - |
1315 | { | - |
1316 | QThread *mainThread = QCoreApplicationPrivate::theMainThread; | - |
1317 | if (!mainThread) partially evaluated: !mainThread no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
1318 | mainThread = QThread::currentThread(); never executed: mainThread = QThread::currentThread(); | 0 |
1319 | mainThread->setEventDispatcher(eventDispatcher); | - |
1320 | } executed: } Execution Count:1 | 1 |
1321 | | - |
1322 | | - |
| | |