Merge remote-tracking branch 'origin/5.3' into 5.4
authorSimon Hausmann <simon.hausmann@digia.com>
Tue, 26 Aug 2014 07:43:33 +0000 (09:43 +0200)
committerSimon Hausmann <simon.hausmann@digia.com>
Tue, 26 Aug 2014 07:51:56 +0000 (09:51 +0200)
Conflicts:
src/qml/qml/qqmlobjectcreator_p.h
Change-Id: I60858ddb46866a8fa1a8576bb05b412afeeb4e41

16 files changed:
1  2 
src/qml/jsruntime/qv4arraydata.cpp
src/qml/jsruntime/qv4globalobject.cpp
src/qml/qml/qqmlincubator.cpp
src/qml/qml/qqmlobjectcreator.cpp
src/qml/qml/qqmlobjectcreator_p.h
src/qml/qml/qqmltypeloader.cpp
src/qml/qml/qqmltypeloader_p.h
src/qml/qml/qqmlvme.cpp
src/qml/types/qqmldelegatemodel_p_p.h
src/qml/types/qqmlinstantiator.cpp
src/qml/types/qqmllistmodel.cpp
src/quick/items/context2d/qquickcontext2d.cpp
src/quick/scenegraph/qsgthreadedrenderloop.cpp
src/quick/util/qquickstatechangescript.cpp
tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
tests/auto/quick/dialogs/tst_dialogs.cpp

@@@ -641,10 -637,10 +641,10 @@@ Property *ArrayData::insert(Object *o, 
  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;
Simple merge
Simple merge
Simple merge
@@@ -100,9 -110,11 +102,11 @@@ private
      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;
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
@@@ -1033,10 -1111,23 +1033,22 @@@ void QSGThreadedRenderLoop::releaseReso
              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();
  }