Skip to content

Commit

Permalink
ios: fix errors
Browse files Browse the repository at this point in the history
  • Loading branch information
igagis committed Mar 3, 2024
1 parent 377d28c commit 5f0b3ba
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/ruisapp/glue/ios/glue.mm
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
#include "../../application.hpp"

#include <utki/destructable.hpp>
#include <utki/util.hpp>

#include <papki/fs_file.hpp>
#include <papki/root_dir.hpp>

#include <sstream>
#include <stdexcept>

#import <UIKit/UIKit.h>
#import <GLKit/GLKit.h>
Expand Down Expand Up @@ -79,7 +83,7 @@ @interface ViewController : GLKViewController{
namespace{
window_params windowParams(0);

struct WindowWrapper : public utki::Unique{
struct WindowWrapper : public utki::destructable{
UIWindow *window;

WindowWrapper(const window_params& wp){
Expand All @@ -88,10 +92,10 @@ @interface ViewController : GLKViewController{
this->window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];

if(!this->window){
throw ruis::Exc("failed to create a UIWindow");
throw std::runtime_error("failed to create a UIWindow");
}

utki::ScopeExit scopeExitWindow([this](){
utki::scope_exit scopeExitWindow([this](){
[this->window release];
});

Expand All @@ -103,14 +107,14 @@ @interface ViewController : GLKViewController{

[this->window makeKeyAndVisible];

scopeExitWindow.reset();
scopeExitWindow.release();
}
~WindowWrapper()noexcept{
[this->window release];
}
};

WindowWrapper& get_impl(const std::unique_ptr<utki::Unique>& pimpl){
WindowWrapper& get_impl(const std::unique_ptr<utki::destructable>& pimpl){
ASSERT(pimpl)
ASSERT(dynamic_cast<WindowWrapper*>(pimpl.get()))
return static_cast<WindowWrapper&>(*pimpl);
Expand Down

0 comments on commit 5f0b3ba

Please sign in to comment.