Don't crash when QCoreApplication is currently being deleted.

In debug mode fixes a crash. The next Q_ASSERT dereferrenced
QCoreApplication::instance().

In release mode fixes hundreds of messages about timers:
"QObject::startTimer: Timers can only be used with threads started
with QThread"

A case where this is reproducible is having a QQuickItem that's child
of qApp, or in some child hierarchy of qApp.

Change-Id: I3b506aefdb537b74dc0d6c755b6874d31be159a1
Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>