Index: /code/branches/core3/src/core/CMakeLists.txt
===================================================================
--- /code/branches/core3/src/core/CMakeLists.txt	(revision 1606)
+++ /code/branches/core3/src/core/CMakeLists.txt	(revision 1607)
@@ -7,5 +7,4 @@
   OrxonoxClass.cc
   Script.cc
-  SignalHandler.cc
 
   # command
Index: /code/branches/core3/src/core/CorePrereqs.h
===================================================================
--- /code/branches/core3/src/core/CorePrereqs.h	(revision 1606)
+++ /code/branches/core3/src/core/CorePrereqs.h	(revision 1607)
@@ -62,6 +62,4 @@
 // Forward declarations
 //-----------------------------------------------------------------------
-class SignalHandler;
-
 namespace orxonox
 {
Index: de/branches/core3/src/core/SignalHandler.cc
===================================================================
--- /code/branches/core3/src/core/SignalHandler.cc	(revision 1606)
+++ 	(revision )
@@ -1,351 +1,0 @@
-/*
- *   ORXONOX - the hottest 3D action shooter ever to exist
- *                    > www.orxonox.net <
- *
- *
- *   License notice:
- *
- *   This program is free software; you can redistribute it and/or
- *   modify it under the terms of the GNU General Public License
- *   as published by the Free Software Foundation; either version 2
- *   of the License, or (at your option) any later version.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with this program; if not, write to the Free Software
- *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- *
- *   Author:
- *      Christoph Renner
- *   Co-authors:
- *      ...
- *
- */
-
-/**
-    @file SignalHandler.cc
-    @brief Implementation of the SignalHandler class.
-*/
-
-#include "SignalHandler.h"
-
-#include <assert.h>
-#include <iostream>
-
-SignalHandler * SignalHandler::singletonRef = NULL;
-
-#ifndef __WIN32__
-
-#include <wait.h>
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-#include <X11/keysym.h>
-
-bool SignalHandler::bXAutoKeyRepeatOn_ = false;
-
-SignalHandler::SignalHandler()
-{
-}
-
-/**
- * register signal handlers for SIGSEGV and SIGABRT
- * @param appName path to executable eg argv[0]
- * @param fileName filename to append backtrace to
- */
-void SignalHandler::doCatch( const std::string & appName, const std::string & fileName )
-{
-  this->appName = appName;
-  this->fileName = fileName;
-
-  // prepare for restoring XAutoKeyRepeat
-  Display* display;
-  if ((display = XOpenDisplay(0)))
-  {
-    XKeyboardState oldState;
-    XGetKeyboardControl(display, &oldState);
-    if (oldState.global_auto_repeat == AutoRepeatModeOn)
-      bXAutoKeyRepeatOn_ = true;
-    else
-      bXAutoKeyRepeatOn_ = false;
-    XCloseDisplay(display);
-  }
-  else
-  {
-    std::cout << "Warning: couldn't open X display to restore XAutoKeyRepeat." << std::endl;
-    bXAutoKeyRepeatOn_ = false;
-  }
-
-
-  // make sure doCatch is only called once without calling dontCatch
-  assert( sigRecList.size() == 0 );
-
-  catchSignal( SIGSEGV );
-  catchSignal( SIGABRT );
-  catchSignal( SIGILL );
-}
-
-/**
- * restore previous signal handlers
- */
-void SignalHandler::dontCatch()
-{
-  for ( SignalRecList::iterator it = sigRecList.begin(); it != sigRecList.end(); it++ )
-  {
-    signal( it->signal, it->handler );
-  }
-
-  sigRecList.clear();
-}
-
-/**
- * catch signal sig
- * @param sig signal to catch
- */
-void SignalHandler::catchSignal( int sig )
-{
-  sig_t handler = signal( sig, SignalHandler::sigHandler );
-
-  assert( handler != SIG_ERR );
-
-  SignalRec rec;
-  rec.signal = sig;
-  rec.handler = handler;
-
-  sigRecList.push_front( rec );
-}
-
-/**
- * sigHandler is called when receiving signals
- * @param sig
- */
-void SignalHandler::sigHandler( int sig )
-{
-  for ( SignalCallbackList::iterator it = SignalHandler::getInstance()->callbackList.begin(); it != SignalHandler::getInstance()->callbackList.end(); it++  )
-  {
-    (*(it->cb))( it->someData );
-  }
-
-  std::string sigName = "UNKNOWN";
-
-  switch ( sig )
-  {
-    case SIGSEGV:
-      sigName = "SIGSEGV";
-      break;
-    case SIGABRT:
-      sigName = "SIGABRT";
-      break;
-    case SIGILL:
-      sigName = "SIGILL";
-      break;
-  }
-
-  if (bXAutoKeyRepeatOn_)
-  {
-    std::cout << "Trying to restore XAutoKeyRepeat" << std::endl;
-    Display* display;
-    if ((display = XOpenDisplay(0)))
-    {
-      XAutoRepeatOn(display);
-      XCloseDisplay(display);
-    }
-  }
-
-  PRINTF(0)( "recieved signal %s\ntry to write backtrace to file orxonox.log\n", sigName.c_str() );
-
-  int sigPipe[2];
-  if ( pipe(sigPipe) == -1 )
-  {
-    perror("pipe failed!\n");
-    exit(EXIT_FAILURE);
-  }
-
-  int sigPid = fork();
-
-  if ( sigPid == -1 )
-  {
-    perror("fork failed!\n");
-    exit(EXIT_FAILURE);
-  }
-
-  // gdb will be attached to this process
-  if ( sigPid == 0 )
-  {
-    getInstance()->dontCatch();
-    // wait for message from parent when it has attached gdb
-    int someData;
-
-    read( sigPipe[0], &someData, sizeof(someData) );
-
-    if ( someData != 0x12345678 )
-    {
-      PRINTF(0)("something went wrong :(\n");
-    }
-
-    return;
-  }
-
-  int gdbIn[2];
-  int gdbOut[2];
-  int gdbErr[2];
-
-  if ( pipe(gdbIn) == -1 || pipe(gdbOut) == -1 || pipe(gdbErr) == -1 )
-  {
-    perror("pipe failed!\n");
-    kill( sigPid, SIGTERM );
-    waitpid( sigPid, NULL, 0 );
-    exit(EXIT_FAILURE);
-  }
-
-  int gdbPid = fork();
-  // this process will run gdb
-
-  if ( gdbPid == -1 )
-  {
-    perror("fork failed\n");
-    kill( sigPid, SIGTERM );
-    waitpid( sigPid, NULL, 0 );
-    exit(EXIT_FAILURE);
-  }
-
-  if ( gdbPid == 0 )
-  {
-    // start gdb
-
-    close(gdbIn[1]);
-    close(gdbOut[0]);
-    close(gdbErr[0]);
-
-    dup2( gdbIn[0], STDIN_FILENO );
-    dup2( gdbOut[1], STDOUT_FILENO );
-    dup2( gdbErr[1], STDERR_FILENO );
-
-    execlp( "sh", "sh", "-c", "gdb", (void*)NULL);
-  }
-
-  char cmd[256];
-  snprintf( cmd, 256, "file %s\nattach %d\nc\n", getInstance()->appName.c_str(), sigPid );
-  write( gdbIn[1], cmd, strlen(cmd) );
-
-  int charsFound = 0;
-  int promptFound = 0;
-  char byte;
-  while ( read( gdbOut[0], &byte, 1 ) == 1 )
-  {
-    if (
-      charsFound == 0 && byte == '(' ||
-      charsFound == 1 && byte == 'g' ||
-      charsFound == 2 && byte == 'd' ||
-      charsFound == 3 && byte == 'b' ||
-      charsFound == 4 && byte == ')' ||
-      charsFound == 5 && byte == ' '
-        )
-          charsFound++;
-    else
-      charsFound = 0;
-
-    if ( charsFound == 6 )
-    {
-      promptFound++;
-      charsFound = 0;
-    }
-
-    if ( promptFound == 3 )
-    {
-      break;
-    }
-  }
-
-  int someData = 0x12345678;
-  write( sigPipe[1], &someData, sizeof(someData) );
-
-  write( gdbIn[1], "bt\nk\nq\n", 7 );
-
-
-  charsFound = 0;
-  promptFound = 0;
-  std::string bt;
-  while ( read( gdbOut[0], &byte, 1 ) == 1 )
-  {
-    bt += std::string( &byte, 1 );
-
-    if (
-      charsFound == 0 && byte == '(' ||
-      charsFound == 1 && byte == 'g' ||
-      charsFound == 2 && byte == 'd' ||
-      charsFound == 3 && byte == 'b' ||
-      charsFound == 4 && byte == ')' ||
-      charsFound == 5 && byte == ' '
-        )
-          charsFound++;
-    else
-      charsFound = 0;
-
-    if ( charsFound == 6 )
-    {
-      promptFound++;
-      charsFound = 0;
-      bt += "\n";
-    }
-
-    if ( promptFound == 3 )
-    {
-      break;
-    }
-  }
-
-
-  waitpid( sigPid, NULL, 0 );
-  waitpid( gdbPid, NULL, 0 );
-
-  int wsRemoved = 0;
-
-  while ( wsRemoved < 2 && bt.length() > 0 )
-  {
-    if ( bt[1] == '\n' )
-      wsRemoved++;
-    bt.erase(0, 1);
-  }
-
-  if ( bt.length() > 0 )
-    bt.erase(0, 1);
-
-  time_t now = time(NULL);
-
-  std::string timeString = "\n\n\n\n"
-                     "=======================================================\n"
-                     "= time: " + std::string(ctime(&now)) +
-         "=======================================================\n";
-  bt.insert(0, timeString);
-
-  FILE * f = fopen( getInstance()->fileName.c_str(), "a" );
-
-  if ( !f )
-  {
-    perror( ( std::string( "could not append to " ) + getInstance()->fileName ).c_str() );
-    exit(EXIT_FAILURE);
-  }
-
-  if ( fwrite( bt.c_str(), 1, bt.length(), f ) != bt.length() )
-  {
-    PRINTF(0)( ( std::string("could not write %d byte to ") + getInstance()->fileName ).c_str(), bt.length());
-    exit(EXIT_FAILURE);
-  }
-
-  exit(EXIT_FAILURE);
-}
-
-void SignalHandler::registerCallback( SignalCallback cb, void * someData )
-{
-  SignalCallbackRec rec;
-  rec.cb = cb;
-  rec.someData = someData;
-
-  callbackList.push_back(rec);
-}
-
-#endif /* __WIN32__ */
Index: de/branches/core3/src/core/SignalHandler.h
===================================================================
--- /code/branches/core3/src/core/SignalHandler.h	(revision 1606)
+++ 	(revision )
@@ -1,108 +1,0 @@
-/*
- *   ORXONOX - the hottest 3D action shooter ever to exist
- *                    > www.orxonox.net <
- *
- *
- *   License notice:
- *
- *   This program is free software; you can redistribute it and/or
- *   modify it under the terms of the GNU General Public License
- *   as published by the Free Software Foundation; either version 2
- *   of the License, or (at your option) any later version.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with this program; if not, write to the Free Software
- *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- *
- *   Author:
- *      Christoph Renner
- *   Co-authors:
- *      ...
- *
- */
-
-/**
-    @file SignalHandler.h
-    @brief Definition of the SignalHandler class.
-*/
-
-#ifndef _SignalHandler_H__
-#define _SignalHandler_H__
-
-#include "CorePrereqs.h"
-
-#include <list>
-#include <string>
-
-typedef int (*SignalCallback)( void * someData );
-
-#ifndef __WIN32__
-#include <signal.h>
-
-struct SignalRec
-{
-  int signal;
-  sig_t handler;
-};
-
-struct SignalCallbackRec
-{
-  SignalCallback cb;
-  void * someData;
-};
-
-
-typedef std::list<SignalRec> SignalRecList;
-typedef std::list<SignalCallbackRec> SignalCallbackList;
-
-class SignalHandler
-{
-  private:
-    SignalHandler();
-  public:
-    inline static SignalHandler* getInstance() { if (!SignalHandler::singletonRef) SignalHandler::singletonRef = new SignalHandler(); return SignalHandler::singletonRef; }
-    ~SignalHandler(){ SignalHandler::singletonRef = NULL; }
-
-    void registerCallback( SignalCallback cb, void * someData );
-
-    void doCatch( const std::string & appName, const std::string & fileName );
-    void dontCatch();
-
-  private:
-    static void sigHandler( int sig );
-
-    void catchSignal( int sig );
-    SignalRecList sigRecList;
-
-    SignalCallbackList callbackList;
-
-    static SignalHandler * singletonRef;
-
-    std::string appName;
-    std::string fileName;
-
-    // used to turn on KeyAutoRepeat if OIS crashes
-    static bool bXAutoKeyRepeatOn_;
-};
-
-#else /* #ifndef __WIN32__ */
-
-class _CoreExport SignalHandler
-{
- public:
-   inline static SignalHandler* getInstance() { if (!SignalHandler::singletonRef) SignalHandler::singletonRef = new SignalHandler(); return SignalHandler::singletonRef; };
-   void doCatch( const std::string & appName, const std::string & fileName ) {};
-  void dontCatch() {};
-  void registerCallback( SignalCallback cb, void * someData ) {};
-
- private:
-    static SignalHandler * singletonRef;
-};
-#endif /* #ifndef __WIN32__ */
-
-#endif /* _SignalHandler_H__ */
Index: /code/branches/core3/src/orxonox/CMakeLists.txt
===================================================================
--- /code/branches/core3/src/orxonox/CMakeLists.txt	(revision 1606)
+++ /code/branches/core3/src/orxonox/CMakeLists.txt	(revision 1607)
@@ -4,4 +4,5 @@
   Orxonox.cc
   Settings.cc
+  SignalHandler.cc
 
   console/InGameConsole.cc
Index: /code/branches/core3/src/orxonox/Main.cc
===================================================================
--- /code/branches/core3/src/orxonox/Main.cc	(revision 1606)
+++ /code/branches/core3/src/orxonox/Main.cc	(revision 1607)
@@ -37,5 +37,5 @@
 
 #include "util/OrxonoxPlatform.h"
-#include "core/SignalHandler.h"
+#include "SignalHandler.h"
 #include "Orxonox.h"
 
Index: /code/branches/core3/src/orxonox/SignalHandler.cc
===================================================================
--- /code/branches/core3/src/orxonox/SignalHandler.cc	(revision 1607)
+++ /code/branches/core3/src/orxonox/SignalHandler.cc	(revision 1607)
@@ -0,0 +1,352 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Christoph Renner
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file SignalHandler.cc
+    @brief Implementation of the SignalHandler class.
+*/
+
+#include "OrxonoxStableHeaders.h"
+#include "SignalHandler.h"
+
+#include <assert.h>
+#include <iostream>
+
+SignalHandler * SignalHandler::singletonRef = NULL;
+
+#if ORXONOX_PLATFORM != ORXONOX_PLATFORM_WIN32
+
+#include <wait.h>
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+#include <X11/keysym.h>
+
+bool SignalHandler::bXAutoKeyRepeatOn_ = false;
+
+SignalHandler::SignalHandler()
+{
+}
+
+/**
+ * register signal handlers for SIGSEGV and SIGABRT
+ * @param appName path to executable eg argv[0]
+ * @param fileName filename to append backtrace to
+ */
+void SignalHandler::doCatch( const std::string & appName, const std::string & fileName )
+{
+  this->appName = appName;
+  this->fileName = fileName;
+
+  // prepare for restoring XAutoKeyRepeat
+  Display* display;
+  if ((display = XOpenDisplay(0)))
+  {
+    XKeyboardState oldState;
+    XGetKeyboardControl(display, &oldState);
+    if (oldState.global_auto_repeat == AutoRepeatModeOn)
+      bXAutoKeyRepeatOn_ = true;
+    else
+      bXAutoKeyRepeatOn_ = false;
+    XCloseDisplay(display);
+  }
+  else
+  {
+    std::cout << "Warning: couldn't open X display to restore XAutoKeyRepeat." << std::endl;
+    bXAutoKeyRepeatOn_ = false;
+  }
+
+
+  // make sure doCatch is only called once without calling dontCatch
+  assert( sigRecList.size() == 0 );
+
+  catchSignal( SIGSEGV );
+  catchSignal( SIGABRT );
+  catchSignal( SIGILL );
+}
+
+/**
+ * restore previous signal handlers
+ */
+void SignalHandler::dontCatch()
+{
+  for ( SignalRecList::iterator it = sigRecList.begin(); it != sigRecList.end(); it++ )
+  {
+    signal( it->signal, it->handler );
+  }
+
+  sigRecList.clear();
+}
+
+/**
+ * catch signal sig
+ * @param sig signal to catch
+ */
+void SignalHandler::catchSignal( int sig )
+{
+  sig_t handler = signal( sig, SignalHandler::sigHandler );
+
+  assert( handler != SIG_ERR );
+
+  SignalRec rec;
+  rec.signal = sig;
+  rec.handler = handler;
+
+  sigRecList.push_front( rec );
+}
+
+/**
+ * sigHandler is called when receiving signals
+ * @param sig
+ */
+void SignalHandler::sigHandler( int sig )
+{
+  for ( SignalCallbackList::iterator it = SignalHandler::getInstance()->callbackList.begin(); it != SignalHandler::getInstance()->callbackList.end(); it++  )
+  {
+    (*(it->cb))( it->someData );
+  }
+
+  std::string sigName = "UNKNOWN";
+
+  switch ( sig )
+  {
+    case SIGSEGV:
+      sigName = "SIGSEGV";
+      break;
+    case SIGABRT:
+      sigName = "SIGABRT";
+      break;
+    case SIGILL:
+      sigName = "SIGILL";
+      break;
+  }
+
+  if (bXAutoKeyRepeatOn_)
+  {
+    std::cout << "Trying to restore XAutoKeyRepeat" << std::endl;
+    Display* display;
+    if ((display = XOpenDisplay(0)))
+    {
+      XAutoRepeatOn(display);
+      XCloseDisplay(display);
+    }
+  }
+
+  PRINTF(0)( "recieved signal %s\ntry to write backtrace to file orxonox.log\n", sigName.c_str() );
+
+  int sigPipe[2];
+  if ( pipe(sigPipe) == -1 )
+  {
+    perror("pipe failed!\n");
+    exit(EXIT_FAILURE);
+  }
+
+  int sigPid = fork();
+
+  if ( sigPid == -1 )
+  {
+    perror("fork failed!\n");
+    exit(EXIT_FAILURE);
+  }
+
+  // gdb will be attached to this process
+  if ( sigPid == 0 )
+  {
+    getInstance()->dontCatch();
+    // wait for message from parent when it has attached gdb
+    int someData;
+
+    read( sigPipe[0], &someData, sizeof(someData) );
+
+    if ( someData != 0x12345678 )
+    {
+      PRINTF(0)("something went wrong :(\n");
+    }
+
+    return;
+  }
+
+  int gdbIn[2];
+  int gdbOut[2];
+  int gdbErr[2];
+
+  if ( pipe(gdbIn) == -1 || pipe(gdbOut) == -1 || pipe(gdbErr) == -1 )
+  {
+    perror("pipe failed!\n");
+    kill( sigPid, SIGTERM );
+    waitpid( sigPid, NULL, 0 );
+    exit(EXIT_FAILURE);
+  }
+
+  int gdbPid = fork();
+  // this process will run gdb
+
+  if ( gdbPid == -1 )
+  {
+    perror("fork failed\n");
+    kill( sigPid, SIGTERM );
+    waitpid( sigPid, NULL, 0 );
+    exit(EXIT_FAILURE);
+  }
+
+  if ( gdbPid == 0 )
+  {
+    // start gdb
+
+    close(gdbIn[1]);
+    close(gdbOut[0]);
+    close(gdbErr[0]);
+
+    dup2( gdbIn[0], STDIN_FILENO );
+    dup2( gdbOut[1], STDOUT_FILENO );
+    dup2( gdbErr[1], STDERR_FILENO );
+
+    execlp( "sh", "sh", "-c", "gdb", (void*)NULL);
+  }
+
+  char cmd[256];
+  snprintf( cmd, 256, "file %s\nattach %d\nc\n", getInstance()->appName.c_str(), sigPid );
+  write( gdbIn[1], cmd, strlen(cmd) );
+
+  int charsFound = 0;
+  int promptFound = 0;
+  char byte;
+  while ( read( gdbOut[0], &byte, 1 ) == 1 )
+  {
+    if (
+      charsFound == 0 && byte == '(' ||
+      charsFound == 1 && byte == 'g' ||
+      charsFound == 2 && byte == 'd' ||
+      charsFound == 3 && byte == 'b' ||
+      charsFound == 4 && byte == ')' ||
+      charsFound == 5 && byte == ' '
+        )
+          charsFound++;
+    else
+      charsFound = 0;
+
+    if ( charsFound == 6 )
+    {
+      promptFound++;
+      charsFound = 0;
+    }
+
+    if ( promptFound == 3 )
+    {
+      break;
+    }
+  }
+
+  int someData = 0x12345678;
+  write( sigPipe[1], &someData, sizeof(someData) );
+
+  write( gdbIn[1], "bt\nk\nq\n", 7 );
+
+
+  charsFound = 0;
+  promptFound = 0;
+  std::string bt;
+  while ( read( gdbOut[0], &byte, 1 ) == 1 )
+  {
+    bt += std::string( &byte, 1 );
+
+    if (
+      charsFound == 0 && byte == '(' ||
+      charsFound == 1 && byte == 'g' ||
+      charsFound == 2 && byte == 'd' ||
+      charsFound == 3 && byte == 'b' ||
+      charsFound == 4 && byte == ')' ||
+      charsFound == 5 && byte == ' '
+        )
+          charsFound++;
+    else
+      charsFound = 0;
+
+    if ( charsFound == 6 )
+    {
+      promptFound++;
+      charsFound = 0;
+      bt += "\n";
+    }
+
+    if ( promptFound == 3 )
+    {
+      break;
+    }
+  }
+
+
+  waitpid( sigPid, NULL, 0 );
+  waitpid( gdbPid, NULL, 0 );
+
+  int wsRemoved = 0;
+
+  while ( wsRemoved < 2 && bt.length() > 0 )
+  {
+    if ( bt[1] == '\n' )
+      wsRemoved++;
+    bt.erase(0, 1);
+  }
+
+  if ( bt.length() > 0 )
+    bt.erase(0, 1);
+
+  time_t now = time(NULL);
+
+  std::string timeString = "\n\n\n\n"
+                     "=======================================================\n"
+                     "= time: " + std::string(ctime(&now)) +
+         "=======================================================\n";
+  bt.insert(0, timeString);
+
+  FILE * f = fopen( getInstance()->fileName.c_str(), "a" );
+
+  if ( !f )
+  {
+    perror( ( std::string( "could not append to " ) + getInstance()->fileName ).c_str() );
+    exit(EXIT_FAILURE);
+  }
+
+  if ( fwrite( bt.c_str(), 1, bt.length(), f ) != bt.length() )
+  {
+    PRINTF(0)( ( std::string("could not write %d byte to ") + getInstance()->fileName ).c_str(), bt.length());
+    exit(EXIT_FAILURE);
+  }
+
+  exit(EXIT_FAILURE);
+}
+
+void SignalHandler::registerCallback( SignalCallback cb, void * someData )
+{
+  SignalCallbackRec rec;
+  rec.cb = cb;
+  rec.someData = someData;
+
+  callbackList.push_back(rec);
+}
+
+#endif /* ORXONOX_PLATFORM == ORXONOX_PLATFORM_WIN32 */
Index: /code/branches/core3/src/orxonox/SignalHandler.h
===================================================================
--- /code/branches/core3/src/orxonox/SignalHandler.h	(revision 1607)
+++ /code/branches/core3/src/orxonox/SignalHandler.h	(revision 1607)
@@ -0,0 +1,109 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Christoph Renner
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file SignalHandler.h
+    @brief Definition of the SignalHandler class.
+*/
+
+#ifndef _SignalHandler_H__
+#define _SignalHandler_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include <list>
+#include <string>
+
+typedef int (*SignalCallback)( void * someData );
+
+#if ORXONOX_PLATFORM != ORXONOX_PLATFORM_WIN32
+#include <signal.h>
+
+struct SignalRec
+{
+  int signal;
+  sig_t handler;
+};
+
+struct SignalCallbackRec
+{
+  SignalCallback cb;
+  void * someData;
+};
+
+
+typedef std::list<SignalRec> SignalRecList;
+typedef std::list<SignalCallbackRec> SignalCallbackList;
+
+class SignalHandler
+{
+  private:
+    SignalHandler();
+  public:
+    inline static SignalHandler* getInstance() { if (!SignalHandler::singletonRef) SignalHandler::singletonRef = new SignalHandler(); return SignalHandler::singletonRef; }
+    ~SignalHandler(){ SignalHandler::singletonRef = NULL; }
+
+    void registerCallback( SignalCallback cb, void * someData );
+
+    void doCatch( const std::string & appName, const std::string & fileName );
+    void dontCatch();
+
+  private:
+    static void sigHandler( int sig );
+
+    void catchSignal( int sig );
+    SignalRecList sigRecList;
+
+    SignalCallbackList callbackList;
+
+    static SignalHandler * singletonRef;
+
+    std::string appName;
+    std::string fileName;
+
+    // used to turn on KeyAutoRepeat if OIS crashes
+    static bool bXAutoKeyRepeatOn_;
+};
+
+#else /* ORXONOX_PLATFORM == ORXONOX_PLATFORM_WIN32 */
+
+class _OrxonoxExport SignalHandler
+{
+  public:
+    inline static SignalHandler* getInstance() { if (!SignalHandler::singletonRef) SignalHandler::singletonRef = new SignalHandler(); return SignalHandler::singletonRef; };
+    void doCatch( const std::string & appName, const std::string & fileName ) {};
+    void dontCatch() {};
+    void registerCallback( SignalCallback cb, void * someData ) {};
+
+  private:
+    static SignalHandler * singletonRef;
+};
+
+#endif /* ORXONOX_PLATFORM == ORXONOX_PLATFORM_WIN32 */
+
+#endif /* _SignalHandler_H__ */
Index: /code/branches/core3/visual_studio/vc8/core.vcproj
===================================================================
--- /code/branches/core3/visual_studio/vc8/core.vcproj	(revision 1606)
+++ /code/branches/core3/visual_studio/vc8/core.vcproj	(revision 1607)
@@ -172,8 +172,4 @@
 				>
 			</File>
-			<File
-				RelativePath="..\..\src\core\SignalHandler.cc"
-				>
-			</File>
 			<Filter
 				Name="tolua"
@@ -358,8 +354,4 @@
 				>
 			</File>
-			<File
-				RelativePath="..\..\src\core\SignalHandler.h"
-				>
-			</File>
 			<Filter
 				Name="input"
Index: /code/branches/core3/visual_studio/vc8/orxonox.vcproj
===================================================================
--- /code/branches/core3/visual_studio/vc8/orxonox.vcproj	(revision 1606)
+++ /code/branches/core3/visual_studio/vc8/orxonox.vcproj	(revision 1607)
@@ -188,4 +188,8 @@
 				>
 			</File>
+			<File
+				RelativePath="..\..\src\orxonox\SignalHandler.cc"
+				>
+			</File>
 			<Filter
 				Name="hud"
@@ -480,4 +484,8 @@
 			<File
 				RelativePath="..\..\src\orxonox\Settings.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\src\orxonox\SignalHandler.h"
 				>
 			</File>
