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
);
/// Initializes the global plugin manager instance
static void staticInitialization();
/// Free the memory taken by staticInitialization()
static void staticShutdown();
MTS_DECLARE_CLASS()
protected:
PluginManager();

View File

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

View File

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

View File

@ -96,7 +96,7 @@ Plugin::~Plugin() {
// Plugin manager
// -----------------------------------------------------------------------
ref<PluginManager> PluginManager::m_instance = new PluginManager();
ref<PluginManager> PluginManager::m_instance = NULL;
PluginManager::PluginManager() {
m_mutex = new Mutex();
@ -172,5 +172,13 @@ void PluginManager::ensurePluginLoaded(const std::string &name) {
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_NAMESPACE_END

View File

@ -63,12 +63,16 @@ Random::Random() {
#if defined(WIN32)
seed();
#else
#if 0
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);
urandom->readULongArray(buf, MT_N);
// seed(buf, MT_N);
seed(buf, MT_N);
#else
seed();
#endif
#endif
}
Random::Random(Random *random) {

View File

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

View File

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

View File

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

View File

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