diff --git a/src/core/haiku/SDL_BeApp.cc b/src/core/haiku/SDL_BeApp.cc index 9a2f98fb06..6eecb26e99 100644 --- a/src/core/haiku/SDL_BeApp.cc +++ b/src/core/haiku/SDL_BeApp.cc @@ -30,6 +30,7 @@ #include #include #include +#include #include "SDL_BApp.h" /* SDL_BApp class definition */ #include "SDL_BeApp.h" @@ -51,8 +52,9 @@ const char *signature = "application/x-SDL-executable"; static int StartBeApp(void *unused) { - BApplication *App; + std::unique_ptr App; + (void)unused; // dig resources for correct signature image_info info; int32 cookie = 0; @@ -69,10 +71,9 @@ static int StartBeApp(void *unused) } } - App = new SDL_BApp(signature); + App = std::unique_ptr(new SDL_BApp(signature)); App->Run(); - delete App; return 0; } diff --git a/src/video/haiku/SDL_bmessagebox.cc b/src/video/haiku/SDL_bmessagebox.cc index 86ba990dec..9f36e94b57 100644 --- a/src/video/haiku/SDL_bmessagebox.cc +++ b/src/video/haiku/SDL_bmessagebox.cc @@ -45,6 +45,7 @@ #include #include #include +#include enum { @@ -355,9 +356,9 @@ HAIKU_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid) // because it is possible to create a MessageBox from another thread. This fixes the following errors: // "You need a valid BApplication object before interacting with the app_server." // "2 BApplication objects were created. Only one is allowed." - BApplication *application = NULL; + std::unique_ptr application; if (be_app == NULL) { - application = new(std::nothrow) BApplication(signature); + application = std::unique_ptr(new(std::nothrow) BApplication(signature)); if (application == NULL) { return SDL_SetError("Cannot create the BApplication object. Lack of memory?"); } @@ -381,10 +382,6 @@ HAIKU_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid) delete messageBox; } */ - if (application != NULL) { - delete application; - } - // Initialize button by real pushed value then. *buttonid = pushedButton;