Showing the changes to interface/src/renderer/TextureCache.cpp (1 of 4 files). Show all
Unified · Split
| @@ -173,7 +173,10 @@ Texture::~Texture() { · 172 unmodified lines | ||
| 173 | 173 | glDeleteTextures(1, &_id); |
| 174 | 174 | } |
| 175 | 175 | |
| 176 | −NetworkTexture::NetworkTexture(const QUrl& url) { | |
| 176 | +NetworkTexture::NetworkTexture(const QUrl& url) : _reply(NULL) { | |
| 177 | + if (!url.isValid()) { | |
| 178 | + return; | |
| 179 | + } | |
| 177 | 180 | QNetworkRequest request(url); |
| 178 | 181 | request.setAttribute(QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::PreferCache); |
| 179 | 182 | _reply = Application::getInstance()->getNetworkAccessManager()->get(request); |
| @@ -182,6 +185,12 @@ NetworkTexture::NetworkTexture(const QUrl& url) { · 2 unmodified lines | ||
| 182 | 185 | connect(_reply, SIGNAL(error(QNetworkReply::NetworkError)), SLOT(handleReplyError())); |
| 183 | 186 | } |
| 184 | 187 | |
| 188 | +NetworkTexture::~NetworkTexture() { | |
| 189 | + if (_reply != NULL) { | |
| 190 | + delete _reply; | |
| 191 | + } | |
| 192 | +} | |
| 193 | + | |
| 185 | 194 | void NetworkTexture::handleDownloadProgress(qint64 bytesReceived, qint64 bytesTotal) { |
| 186 | 195 | if (bytesReceived < bytesTotal && !_reply->isFinished()) { |
| 187 | 196 | return; |