Fix for missing voxel system on domain change. Fix for assertion failure thrown by Qt on exit.

This commit is contained in:
matsukaze 2014-04-02 17:45:22 -07:00
parent f305b81655
commit d28d686ceb
3 changed files with 9 additions and 4 deletions

View file

@ -16,6 +16,7 @@
#include "ImageOverlay.h"
ImageOverlay::ImageOverlay() :
_manager(0),
_textureID(0),
_renderImage(false),
_textureBound(false),
@ -33,9 +34,9 @@ ImageOverlay::~ImageOverlay() {
// TODO: handle setting image multiple times, how do we manage releasing the bound texture?
void ImageOverlay::setImageURL(const QUrl& url) {
// TODO: are we creating too many QNetworkAccessManager() when multiple calls to setImageURL are made?
QNetworkAccessManager* manager = new QNetworkAccessManager(this);
connect(manager, SIGNAL(finished(QNetworkReply*)), this, SLOT(replyFinished(QNetworkReply*)));
manager->get(QNetworkRequest(url));
_manager = new QNetworkAccessManager();
connect(_manager, SIGNAL(finished(QNetworkReply*)), this, SLOT(replyFinished(QNetworkReply*)));
_manager->get(QNetworkRequest(url));
}
void ImageOverlay::replyFinished(QNetworkReply* reply) {
@ -44,7 +45,7 @@ void ImageOverlay::replyFinished(QNetworkReply* reply) {
QByteArray rawData = reply->readAll();
_textureImage.loadFromData(rawData);
_renderImage = true;
_manager->deleteLater();
}
void ImageOverlay::render() {

View file

@ -49,6 +49,8 @@ private:
QUrl _imageURL;
QImage _textureImage;
QNetworkAccessManager* _manager;
GLuint _textureID;
QRect _fromImage; // where from in the image to sample
bool _renderImage; // is there an image associated with this overlay, or is it just a colored rectangle

View file

@ -1508,7 +1508,9 @@ void VoxelSystem::killLocalVoxels() {
PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings),
"VoxelSystem::killLocalVoxels()");
_tree->lockForWrite();
VoxelSystem* voxelSystem = _tree->getRoot()->getVoxelSystem();
_tree->eraseAllOctreeElements();
_tree->getRoot()->setVoxelSystem(voxelSystem);
_tree->unlock();
clearFreeBufferIndexes();
if (_usePrimitiveRenderer) {