wind: Move more fallible operations before window creation
All checks were successful
continuous-integration/drone/pr Build is passing
All checks were successful
continuous-integration/drone/pr Build is passing
This commit is contained in:
parent
a2b6149f50
commit
8ab823fc43
@ -11,6 +11,7 @@
|
||||
auto _expr_rc = (expr); \
|
||||
if (!_expr_rc.has_value()) \
|
||||
{ \
|
||||
g_windows.remove(window); \
|
||||
delete window; \
|
||||
os::IPC::send_error(client.conn, _expr_rc.error()); \
|
||||
return {}; \
|
||||
@ -65,6 +66,8 @@ static Result<void> handle_create_window_message(Client& client)
|
||||
|
||||
auto name = TRY(String::from_cstring("Window"));
|
||||
|
||||
auto shm_path = TRY(String::format("/wind-shm-%d-%lu"_sv, client.conn.fd(), time(NULL)));
|
||||
|
||||
auto* window = new (std::nothrow) Window(request.rect, move(name), request.decorated);
|
||||
if (!window)
|
||||
{
|
||||
@ -72,8 +75,6 @@ static Result<void> handle_create_window_message(Client& client)
|
||||
return {};
|
||||
}
|
||||
|
||||
auto shm_path = TRY_OR_IPC_ERROR(String::format("/wind-shm-%d-%lu"_sv, client.conn.fd(), time(NULL)));
|
||||
|
||||
window->pixels = (u32*)TRY_OR_IPC_ERROR(
|
||||
os::SharedMemory::create(shm_path.view(), window->contents.height * window->contents.width * 4));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user