Use she::error_message() in app_main()

This commit is contained in:
David Capello 2014-06-18 00:59:50 -03:00
parent 7d0e0f4b4a
commit 1ff5e82cef

View File

@ -1,5 +1,5 @@
/* Aseprite /* Aseprite
* Copyright (C) 2001-2013 David Capello * Copyright (C) 2001-2014 David Capello
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -26,7 +26,9 @@
#include "base/exception.h" #include "base/exception.h"
#include "base/memory.h" #include "base/memory.h"
#include "base/memory_dump.h" #include "base/memory_dump.h"
#include "she/she.h" #include "she/error.h"
#include "she/scoped_handle.h"
#include "she/system.h"
#include "ui/base.h" #include "ui/base.h"
#include <cstdlib> #include <cstdlib>
@ -51,16 +53,12 @@ namespace {
class MemLeak { class MemLeak {
public: public:
MemLeak() {
#ifdef MEMLEAK #ifdef MEMLEAK
base_memleak_init(); MemLeak() { base_memleak_init(); }
~MemLeak() { base_memleak_exit(); }
#else
MemLeak() { }
#endif #endif
}
~MemLeak() {
#ifdef MEMLEAK
base_memleak_exit();
#endif
}
}; };
bool getMemoryDumpFilename(std::string& filename) bool getMemoryDumpFilename(std::string& filename)
@ -77,7 +75,7 @@ namespace {
} }
// ASEPRITE entry point. (Called from she library.) // Aseprite entry point. (Called from she library.)
int app_main(int argc, char* argv[]) int app_main(int argc, char* argv[])
{ {
// Initialize the random seed. // Initialize the random seed.
@ -105,9 +103,7 @@ int app_main(int argc, char* argv[])
} }
catch (std::exception& e) { catch (std::exception& e) {
std::cerr << e.what() << '\n'; std::cerr << e.what() << '\n';
#ifdef WIN32 she::error_message(e.what());
::MessageBoxA(NULL, e.what(), PACKAGE, MB_OK | MB_ICONERROR);
#endif
return 1; return 1;
} }
} }