class ArrayElementLessThan
{
public:
- inline ArrayElementLessThan(ExecutionContext *context, ObjectRef thisObject, const ValueRef comparefn)
+ inline ArrayElementLessThan(ExecutionContext *context, Object *thisObject, const ValueRef comparefn)
: m_context(context), thisObject(thisObject), m_comparefn(comparefn) {}
- bool operator()(const Value &v1, const Value &v2) const;
+ bool operator()(Value v1, Value v2) const;
private:
ExecutionContext *m_context;
void setPropertyValue(QQmlPropertyData *property, const QV4::CompiledData::Binding *binding);
void setupFunctions();
- QString stringAt(int idx) const { return qmlUnit->header.stringAt(idx); }
+ QString stringAt(int idx) const { return qmlUnit->stringAt(idx); }
void recordError(const QV4::CompiledData::Location &location, const QString &description);
+ void registerObjectWithContextById(int objectIndex, QObject *instance) const;
+
enum Phase {
Startup,
CreatingObjects,
QQmlEngine *engine;
QQmlCompiledData *compiledData;
- const QV4::CompiledData::QmlUnit *qmlUnit;
+ const QV4::CompiledData::Unit *qmlUnit;
- QQmlContextData *parentContext;
+ QQmlGuardedContextData parentContext;
QQmlContextData *context;
const QHash<int, QQmlCompiledData::TypeReference*> &resolvedTypes;
const QVector<QQmlPropertyCache *> &propertyCaches;
fallback->create();
}
- QSG_GUI_DEBUG(w->window, " - posting release request to render thread");
+ qCDebug(QSG_LOG_RENDERLOOP) << "- posting release request to render thread";
w->thread->postEvent(new WMTryReleaseEvent(window, inDestructor, fallback));
w->thread->waitCondition.wait(&w->thread->mutex);
-
delete fallback;
- QSG_GUI_DEBUG(w->window, " - waiting for render thread to exit");
+
+ // Avoid a shutdown race condition.
+ // If SG is invalidated and 'active' becomes false, the thread's run()
+ // method will exit. handleExposure() relies on QThread::isRunning() (because it
+ // potentially needs to start the thread again) and our mutex cannot be used to
+ // track the thread stopping, so we wait a few nanoseconds extra so the thread
+ // can exit properly.
+ if (!w->thread->active) {
- QSG_GUI_DEBUG(w->window, " - render thread finished");
++ qCDebug(QSG_LOG_RENDERLOOP) << " - waiting for render thread to exit" << w->window;
+ w->thread->wait();
++ qCDebug(QSG_LOG_RENDERLOOP) << " - render thread finished" << w->window;
+ }
}
w->thread->mutex.unlock();
}