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

View file

@ -49,6 +49,8 @@ private:
QUrl _imageURL; QUrl _imageURL;
QImage _textureImage; QImage _textureImage;
QNetworkAccessManager* _manager;
GLuint _textureID; GLuint _textureID;
QRect _fromImage; // where from in the image to sample 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 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), PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings),
"VoxelSystem::killLocalVoxels()"); "VoxelSystem::killLocalVoxels()");
_tree->lockForWrite(); _tree->lockForWrite();
VoxelSystem* voxelSystem = _tree->getRoot()->getVoxelSystem();
_tree->eraseAllOctreeElements(); _tree->eraseAllOctreeElements();
_tree->getRoot()->setVoxelSystem(voxelSystem);
_tree->unlock(); _tree->unlock();
clearFreeBufferIndexes(); clearFreeBufferIndexes();
if (_usePrimitiveRenderer) { if (_usePrimitiveRenderer) {