paysages: Fixed the random segfault at startup.

git-svn-id: https://subversion.assembla.com/svn/thunderk/paysages@258 b1fd45b6-86a6-48da-8261-f70d1f35bdcc
This commit is contained in:
Michaël Lemaire 2012-02-05 12:17:51 +00:00 committed by ThunderK
parent 5bfb590cb0
commit 007c5769e5
5 changed files with 12 additions and 5 deletions

1
TODO
View file

@ -2,5 +2,4 @@
- Implement light multi-sampling (mainly for skydome). - Implement light multi-sampling (mainly for skydome).
- Implement scaling and scrolling on previews. - Implement scaling and scrolling on previews.
- Water and terrain LOD moves with the camera, fix it like in the wanderer. - Water and terrain LOD moves with the camera, fix it like in the wanderer.
- Find the random segfault at start (in PreviewTerrainColor::getColor).
- Restore render progress. - Restore render progress.

View file

@ -152,6 +152,7 @@ void BaseForm::addPreview(Preview* preview, QString label)
previews->layout()->addWidget(new QLabel(label, previews)); previews->layout()->addWidget(new QLabel(label, previews));
previews->layout()->addWidget(preview); previews->layout()->addWidget(preview);
preview->start();
preview->setObjectName("_form_preview_"); preview->setObjectName("_form_preview_");
} }

View file

@ -98,10 +98,12 @@ DialogNoise::DialogNoise(QWidget *parent, NoiseGenerator* value):
previews->layout()->addWidget(new QLabel("Level preview")); previews->layout()->addWidget(new QLabel("Level preview"));
previews->layout()->addWidget(previewLevel); previews->layout()->addWidget(previewLevel);
previewLevel->setScaling(1.0 / 127.0); previewLevel->setScaling(1.0 / 127.0);
previewLevel->start();
previewTotal = new PreviewTotal(previews, _current); previewTotal = new PreviewTotal(previews, _current);
previews->layout()->addWidget(new QLabel("Total preview")); previews->layout()->addWidget(new QLabel("Total preview"));
previews->layout()->addWidget(previewTotal); previews->layout()->addWidget(previewTotal);
previewTotal->setScaling(1.0 / 127.0); previewTotal->setScaling(1.0 / 127.0);
previewTotal->start();
form = new QWidget(this); form = new QWidget(this);
form->setLayout(new QVBoxLayout()); form->setLayout(new QVBoxLayout());

View file

@ -61,7 +61,6 @@ Preview::Preview(QWidget* parent) :
QObject::connect(this, SIGNAL(redrawRequested()), this, SLOT(handleRedraw())); QObject::connect(this, SIGNAL(redrawRequested()), this, SLOT(handleRedraw()));
this->updater = new PreviewDrawer(this); this->updater = new PreviewDrawer(this);
this->updater->start();
} }
Preview::~Preview() Preview::~Preview()
@ -73,7 +72,8 @@ Preview::~Preview()
delete updater; delete updater;
delete pixbuf; delete pixbuf;
delete lock_drawing;;} delete lock_drawing;
}
void Preview::updateData() void Preview::updateData()
{ {
@ -84,6 +84,11 @@ QColor Preview::getColor(double x, double y)
return QColor(0, 0, 0); return QColor(0, 0, 0);
} }
void Preview::start()
{
this->updater->start();
}
void Preview::doRender() void Preview::doRender()
{ {
if (this->alive) if (this->alive)

View file

@ -14,6 +14,7 @@ public:
Preview(QWidget* parent); Preview(QWidget* parent);
~Preview(); ~Preview();
void start();
void doRender(); void doRender();
void redraw(); void redraw();
@ -30,7 +31,6 @@ protected:
private: private:
void forceRender(); void forceRender();
void renderPixbuf(); void renderPixbuf();
static void startUpdater();
void resizeEvent(QResizeEvent* event); void resizeEvent(QResizeEvent* event);
void paintEvent(QPaintEvent* event); void paintEvent(QPaintEvent* event);