mtsimport crash bugfix

metadata
Wenzel Jakob 2010-08-24 11:19:13 +02:00
parent 6ee899edb1
commit 378833cefd
9 changed files with 37 additions and 4 deletions

View File

@ -79,6 +79,12 @@ public:
const Properties &props const Properties &props
); );
/// Initializes the global plugin manager instance
static void staticInitialization();
/// Free the memory taken by staticInitialization()
static void staticShutdown();
MTS_DECLARE_CLASS() MTS_DECLARE_CLASS()
protected: protected:
PluginManager(); PluginManager();

View File

@ -57,6 +57,8 @@ public:
/// Return a bitmap representation of the full-resolution image (8 bit/color) /// Return a bitmap representation of the full-resolution image (8 bit/color)
Bitmap *getLDRBitmap() const; Bitmap *getLDRBitmap() const;
MTS_DECLARE_CLASS()
protected: protected:
struct ResampleWeight { struct ResampleWeight {
int firstTexel; int firstTexel;
@ -78,8 +80,6 @@ protected:
/* Virtual destructor */ /* Virtual destructor */
virtual ~MIPMap(); virtual ~MIPMap();
MTS_DECLARE_CLASS()
private: private:
int m_width, m_height; int m_width, m_height;
int m_levels; int m_levels;

View File

@ -34,6 +34,7 @@
#include "converter.h" #include "converter.h"
#include <mitsuba/hw/glrenderer.h> #include <mitsuba/hw/glrenderer.h>
#include <mitsuba/core/fresolver.h> #include <mitsuba/core/fresolver.h>
#include <mitsuba/core/plugin.h>
#if defined(WIN32) #if defined(WIN32)
#include "../mitsuba/getopt.h" #include "../mitsuba/getopt.h"
#endif #endif
@ -155,6 +156,7 @@ int ubi_main(int argc, char **argv) {
/* Initialize the core framework */ /* Initialize the core framework */
Class::staticInitialization(); Class::staticInitialization();
PluginManager::staticInitialization();
Statistics::staticInitialization(); Statistics::staticInitialization();
Thread::staticInitialization(); Thread::staticInitialization();
Logger::staticInitialization(); Logger::staticInitialization();
@ -195,6 +197,8 @@ int ubi_main(int argc, char **argv) {
ref<Session> session = Session::create(); ref<Session> session = Session::create();
ref<Device> device = Device::create(session); ref<Device> device = Device::create(session);
ref<Renderer> renderer = Renderer::create(session); ref<Renderer> renderer = Renderer::create(session);
renderer->setLogLevel(ETrace);
renderer->setWarnLogLevel(ETrace);
session->init(); session->init();
device->init(); device->init();
@ -233,6 +237,7 @@ int ubi_main(int argc, char **argv) {
Logger::staticShutdown(); Logger::staticShutdown();
Thread::staticShutdown(); Thread::staticShutdown();
Statistics::staticShutdown(); Statistics::staticShutdown();
PluginManager::staticShutdown();
Class::staticShutdown(); Class::staticShutdown();
return retval; return retval;

View File

@ -96,7 +96,7 @@ Plugin::~Plugin() {
// Plugin manager // Plugin manager
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
ref<PluginManager> PluginManager::m_instance = new PluginManager(); ref<PluginManager> PluginManager::m_instance = NULL;
PluginManager::PluginManager() { PluginManager::PluginManager() {
m_mutex = new Mutex(); m_mutex = new Mutex();
@ -172,5 +172,13 @@ void PluginManager::ensurePluginLoaded(const std::string &name) {
Log(EError, "Plugin \"%s\" not found!", name.c_str()); Log(EError, "Plugin \"%s\" not found!", name.c_str());
} }
void PluginManager::staticInitialization() {
m_instance = new PluginManager();
}
void PluginManager::staticShutdown() {
m_instance = NULL;
}
MTS_IMPLEMENT_CLASS(PluginManager, false, Object) MTS_IMPLEMENT_CLASS(PluginManager, false, Object)
MTS_NAMESPACE_END MTS_NAMESPACE_END

View File

@ -63,12 +63,16 @@ Random::Random() {
#if defined(WIN32) #if defined(WIN32)
seed(); seed();
#else #else
#if 0
uint64_t buf[MT_N]; uint64_t buf[MT_N];
memset(buf, 0, MT_N * sizeof(uint64_t)); /* Make GCC happy */
ref<FileStream> urandom = new FileStream("/dev/urandom", FileStream::EReadOnly); ref<FileStream> urandom = new FileStream("/dev/urandom", FileStream::EReadOnly);
urandom->readULongArray(buf, MT_N); urandom->readULongArray(buf, MT_N);
// seed(buf, MT_N); seed(buf, MT_N);
#else
seed(); seed();
#endif #endif
#endif
} }
Random::Random(Random *random) { Random::Random(Random *random) {

View File

@ -321,6 +321,7 @@ int ubi_main(int argc, char **argv) {
int main(int argc, char **argv) { int main(int argc, char **argv) {
/* Initialize the core framework */ /* Initialize the core framework */
Class::staticInitialization(); Class::staticInitialization();
PluginManager::staticInitialization();
Statistics::staticInitialization(); Statistics::staticInitialization();
Thread::staticInitialization(); Thread::staticInitialization();
Logger::staticInitialization(); Logger::staticInitialization();
@ -390,6 +391,7 @@ int main(int argc, char **argv) {
Logger::staticShutdown(); Logger::staticShutdown();
Thread::staticShutdown(); Thread::staticShutdown();
Statistics::staticShutdown(); Statistics::staticShutdown();
PluginManager::staticShutdown();
Class::staticShutdown(); Class::staticShutdown();
#ifdef WIN32 #ifdef WIN32

View File

@ -4,6 +4,7 @@
#include <mitsuba/core/sshstream.h> #include <mitsuba/core/sshstream.h>
#include <mitsuba/core/shvector.h> #include <mitsuba/core/shvector.h>
#include <mitsuba/core/fresolver.h> #include <mitsuba/core/fresolver.h>
#include <mitsuba/core/plugin.h>
#include <fstream> #include <fstream>
#include <stdexcept> #include <stdexcept>
@ -354,6 +355,7 @@ int ubi_main(int argc, char **argv) {
int main(int argc, char **argv) { int main(int argc, char **argv) {
/* Initialize the core framework */ /* Initialize the core framework */
Class::staticInitialization(); Class::staticInitialization();
PluginManager::staticInitialization();
Statistics::staticInitialization(); Statistics::staticInitialization();
Thread::staticInitialization(); Thread::staticInitialization();
Logger::staticInitialization(); Logger::staticInitialization();
@ -413,6 +415,7 @@ int main(int argc, char **argv) {
Logger::staticShutdown(); Logger::staticShutdown();
Thread::staticShutdown(); Thread::staticShutdown();
Statistics::staticShutdown(); Statistics::staticShutdown();
PluginManager::staticShutdown();
Class::staticShutdown(); Class::staticShutdown();

View File

@ -303,6 +303,7 @@ int ubi_main(int argc, char **argv) {
int main(int argc, char **argv) { int main(int argc, char **argv) {
/* Initialize the core framework */ /* Initialize the core framework */
Class::staticInitialization(); Class::staticInitialization();
PluginManager::staticInitialization();
Statistics::staticInitialization(); Statistics::staticInitialization();
Thread::staticInitialization(); Thread::staticInitialization();
Logger::staticInitialization(); Logger::staticInitialization();
@ -372,6 +373,7 @@ int main(int argc, char **argv) {
Logger::staticShutdown(); Logger::staticShutdown();
Thread::staticShutdown(); Thread::staticShutdown();
Statistics::staticShutdown(); Statistics::staticShutdown();
PluginManager::staticShutdown();
Class::staticShutdown(); Class::staticShutdown();
#ifdef WIN32 #ifdef WIN32

View File

@ -2,6 +2,7 @@
#include <QtGui/QtGui> #include <QtGui/QtGui>
#include <mitsuba/core/shvector.h> #include <mitsuba/core/shvector.h>
#include <mitsuba/core/sched.h> #include <mitsuba/core/sched.h>
#include <mitsuba/core/plugin.h>
#if defined(__OSX__) #if defined(__OSX__)
#include <ApplicationServices/ApplicationServices.h> #include <ApplicationServices/ApplicationServices.h>
#endif #endif
@ -77,6 +78,7 @@ int main(int argc, char *argv[]) {
/* Initialize the core framework */ /* Initialize the core framework */
Class::staticInitialization(); Class::staticInitialization();
PluginManager::staticInitialization();
Statistics::staticInitialization(); Statistics::staticInitialization();
Thread::staticInitialization(); Thread::staticInitialization();
Logger::staticInitialization(); Logger::staticInitialization();
@ -204,6 +206,7 @@ int main(int argc, char *argv[]) {
Logger::staticShutdown(); Logger::staticShutdown();
Thread::staticShutdown(); Thread::staticShutdown();
Statistics::staticShutdown(); Statistics::staticShutdown();
PluginManager::staticShutdown();
Class::staticShutdown(); Class::staticShutdown();
return retval; return retval;