QQuickCanvas renames
[profile/ivi/qtdeclarative.git] / src / quick / util / qquickpixmapcache.cpp
index 9f11062..1f4da46 100644 (file)
@@ -66,6 +66,7 @@
 #include <private/qobject_p.h>
 #include <QSslError>
 #include <QQmlFile>
+#include <QMetaMethod>
 
 #define IMAGEREQUEST_MAX_REQUEST_COUNT       8
 #define IMAGEREQUEST_MAX_REDIRECT_RECURSION 16
@@ -87,7 +88,7 @@ static inline QString imageId(const QUrl &url)
     return url.toString(QUrl::RemoveScheme | QUrl::RemoveAuthority).mid(1);
 }
 
-QSGTexture *QQuickDefaultTextureFactory::createTexture(QQuickCanvas *) const
+QSGTexture *QQuickDefaultTextureFactory::createTexture(QQuickWindow *) const
 {
     QSGPlainTexture *t = new QSGPlainTexture();
     t->setImage(im);
@@ -373,6 +374,8 @@ QQuickPixmapReader::~QQuickPixmapReader()
     mutex.lock();
     // manually cancel all outstanding jobs.
     foreach (QQuickPixmapReply *reply, jobs) {
+        if (reply->data && reply->data->reply == reply)
+            reply->data->reply = 0;
         delete reply;
     }
     jobs.clear();
@@ -633,12 +636,10 @@ void QQuickPixmapReader::cancel(QQuickPixmapReply *reply)
 void QQuickPixmapReader::run()
 {
     if (replyDownloadProgress == -1) {
-        const QMetaObject *nr = &QNetworkReply::staticMetaObject;
-        const QMetaObject *pr = &QQuickPixmapReply::staticMetaObject;
+        replyDownloadProgress = QMetaMethod::fromSignal(&QNetworkReply::downloadProgress).methodIndex();
+        replyFinished = QMetaMethod::fromSignal(&QNetworkReply::finished).methodIndex();
+        downloadProgress = QMetaMethod::fromSignal(&QQuickPixmapReply::downloadProgress).methodIndex();
         const QMetaObject *ir = &QQuickPixmapReaderThreadObject::staticMetaObject;
-        replyDownloadProgress = nr->indexOfSignal("downloadProgress(qint64,qint64)");
-        replyFinished = nr->indexOfSignal("finished()");
-        downloadProgress = pr->indexOfSignal("downloadProgress(qint64,qint64)");
         threadNetworkRequestDone = ir->indexOfSlot("networkRequestDone()");
     }
 
@@ -832,13 +833,15 @@ QQuickPixmapReply::QQuickPixmapReply(QQuickPixmapData *d)
 : data(d), engineForReader(0), requestSize(d->requestSize), url(d->url), loading(false), redirectCount(0)
 {
     if (finishedIndex == -1) {
-        finishedIndex = QQuickPixmapReply::staticMetaObject.indexOfSignal("finished()");
-        downloadProgressIndex = QQuickPixmapReply::staticMetaObject.indexOfSignal("downloadProgress(qint64,qint64)");
+        finishedIndex = QMetaMethod::fromSignal(&QQuickPixmapReply::finished).methodIndex();
+        downloadProgressIndex = QMetaMethod::fromSignal(&QQuickPixmapReply::downloadProgress).methodIndex();
     }
 }
 
 QQuickPixmapReply::~QQuickPixmapReply()
 {
+    // note: this->data->reply must be set to zero if this->data->reply == this
+    // but it must be done within mutex locking, to be guaranteed to be safe.
 }
 
 bool QQuickPixmapReply::event(QEvent *event)