diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Image.cc | 4 | ||||
-rw-r--r-- | lib/Main.cc | 13 |
2 files changed, 5 insertions, 12 deletions
diff --git a/lib/Image.cc b/lib/Image.cc index 2e33da7..a0ece1b 100644 --- a/lib/Image.cc +++ b/lib/Image.cc @@ -9,9 +9,7 @@ Image::Image(unsigned int ax, unsigned int ay) : x(ax), y(ay), img((Color *) mal } Image::~Image() { - char * t = (char *) img; - free(t); - img = 0; + free((char *&) img); } bool Image::CanWrite() const { diff --git a/lib/Main.cc b/lib/Main.cc index 653adea..5571689 100644 --- a/lib/Main.cc +++ b/lib/Main.cc @@ -8,8 +8,6 @@ Main::Main() : setted(false) {} Main::~Main() {} -extern Main * Application; - void Main::set_args(int a_argc, char ** a_argv, char ** a_enve) { if (setted) { return; @@ -20,7 +18,7 @@ void Main::set_args(int a_argc, char ** a_argv, char ** a_enve) { setted = true; } -int main(int argc, char ** argv, char ** enve) { +int Main::truemain(Main * Application, int argc, char ** argv, char ** enve) { int r; try { @@ -32,14 +30,11 @@ int main(int argc, char ** argv, char ** enve) { } catch (GeneralException e) { Base::printm(M_ERROR, "The application caused an exception: %s\n", e.GetMsg()); - delete Application; - exit(-1); + return -1; } catch (...) { Base::printm(M_ERROR, "The application caused an unknow exception\n"); - delete Application; - exit(-1); + return -1; } - delete Application; - exit(r); + return r; } |