mirror of
https://github.com/glest/glest-source.git
synced 2025-08-12 03:14:00 +02:00
- got built in memory leak working. Just edit leak_dumper.h and uncomment:
//#define SL_LEAK_DUMP - got better / more accurate stack dumps when we detect errors in game. - Both of these need to be worked on in windows next, win32 may not compile for now until i fix it on that platform. - BE VERY CAREFUL when working in leak_dumper.* it may cause GCC and your system to crash if you don't know what you are doing!
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <stdexcept>
|
||||
#include "platform_util.h"
|
||||
#include "leak_dumper.h"
|
||||
|
||||
using namespace std;
|
||||
@@ -69,7 +70,7 @@ protected:
|
||||
safeMutex.ReleaseLock();
|
||||
}
|
||||
catch(const std::exception &ex) {
|
||||
throw runtime_error(ex.what());
|
||||
throw megaglest_runtime_error(ex.what());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -80,7 +81,7 @@ protected:
|
||||
safeMutex.ReleaseLock();
|
||||
}
|
||||
catch(const std::exception &ex) {
|
||||
throw runtime_error(ex.what());
|
||||
throw megaglest_runtime_error(ex.what());
|
||||
}
|
||||
}
|
||||
// If this is the first access we return a default object of the type
|
||||
|
@@ -464,7 +464,7 @@ int mainSetup(int argc, char **argv) {
|
||||
if(knownArgCount != GAME_ARG_END) {
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,"Internal arg count mismatch knownArgCount = %d, GAME_ARG_END = %d",knownArgCount,GAME_ARG_END);
|
||||
throw runtime_error(szBuf);
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
|
||||
if( hasCommandArgument(argc, argv,GAME_ARGS[GAME_ARG_OPENGL_INFO]) == true ||
|
||||
|
@@ -22,12 +22,20 @@ using std::exception;
|
||||
|
||||
namespace Shared { namespace Platform {
|
||||
|
||||
class megaglest_runtime_error : public runtime_error {
|
||||
public:
|
||||
megaglest_runtime_error(const string& __arg);
|
||||
};
|
||||
|
||||
// =====================================================
|
||||
// class PlatformExceptionHandler
|
||||
// =====================================================
|
||||
|
||||
class PlatformExceptionHandler {
|
||||
public:
|
||||
static string application_binary;
|
||||
static string getStackTrace();
|
||||
|
||||
virtual ~PlatformExceptionHandler() {}
|
||||
void install(string dumpFileName) {}
|
||||
virtual void handle()=0;
|
||||
|
@@ -25,7 +25,7 @@
|
||||
//#include "util.h"
|
||||
#include <vector>
|
||||
#include "types.h"
|
||||
#include "leak_dumper.h"
|
||||
//#include "leak_dumper.h"
|
||||
|
||||
// =====================================================
|
||||
// class Thread
|
||||
|
@@ -12,7 +12,7 @@
|
||||
#define _SHARED_PLATFORM_TYPES_H_
|
||||
|
||||
#include <SDL_types.h>
|
||||
#include "leak_dumper.h"
|
||||
//#include "leak_dumper.h"
|
||||
|
||||
namespace Shared{ namespace Platform{
|
||||
|
||||
|
@@ -28,13 +28,18 @@ LPWSTR Ansi2WideString(LPCSTR lpaszString);
|
||||
std::string utf8_encode(const std::wstring wstr);
|
||||
std::wstring utf8_decode(const std::string str);
|
||||
|
||||
class megaglest_runtime_error : public runtime_error {
|
||||
public:
|
||||
megaglest_runtime_error(const string& __arg);
|
||||
};
|
||||
|
||||
// =====================================================
|
||||
// class PlatformExceptionHandler
|
||||
// =====================================================
|
||||
|
||||
LONG WINAPI UnhandledExceptionFilter2(struct _EXCEPTION_POINTERS *ExceptionInfo);
|
||||
|
||||
class PlatformExceptionHandler{
|
||||
class PlatformExceptionHandler {
|
||||
private:
|
||||
static PlatformExceptionHandler *thisPointer;
|
||||
|
||||
@@ -43,6 +48,9 @@ private:
|
||||
string dumpFileName;
|
||||
|
||||
public:
|
||||
static string application_binary;
|
||||
static string getStackTrace();
|
||||
|
||||
void install(string dumpFileName);
|
||||
virtual void handle()=0;
|
||||
static string codeToStr(DWORD code);
|
||||
|
Reference in New Issue
Block a user