mirror of
https://github.com/seekrs/MacroLibX.git
synced 2026-09-03 01:40:02 +02:00
Fixed crash on NULL window titles + typo
This commit is contained in:
@@ -23,7 +23,7 @@ namespace mlx
|
|||||||
|
|
||||||
inline void OnEvent(mlx_window win, int event, void(*f)(int, void*), void* param) noexcept;
|
inline void OnEvent(mlx_window win, int event, void(*f)(int, void*), void* param) noexcept;
|
||||||
|
|
||||||
inline mlx_window NewGraphicsSuport(const mlx_window_create_info* info);
|
inline mlx_window NewGraphicsSupport(const mlx_window_create_info* info);
|
||||||
inline NonOwningPtr<GraphicsSupport> GetGraphicsSupport(mlx_window win);
|
inline NonOwningPtr<GraphicsSupport> GetGraphicsSupport(mlx_window win);
|
||||||
inline void DestroyGraphicsSupport(mlx_window win);
|
inline void DestroyGraphicsSupport(mlx_window win);
|
||||||
|
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ namespace mlx
|
|||||||
m_fps.SetMaxFPS(fps);
|
m_fps.SetMaxFPS(fps);
|
||||||
}
|
}
|
||||||
|
|
||||||
mlx_window Application::NewGraphicsSuport(const mlx_window_create_info* info)
|
mlx_window Application::NewGraphicsSupport(const mlx_window_create_info* info)
|
||||||
{
|
{
|
||||||
MLX_PROFILE_FUNCTION();
|
MLX_PROFILE_FUNCTION();
|
||||||
if(!info)
|
if(!info)
|
||||||
@@ -68,6 +68,11 @@ namespace mlx
|
|||||||
Error("invalid window create info (NULL)");
|
Error("invalid window create info (NULL)");
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
if (info->title == nullptr)
|
||||||
|
{
|
||||||
|
mlx::Error("invalid window title (NULL)");
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
mlx_window window;
|
mlx_window window;
|
||||||
try { window = new mlx_window_handler; }
|
try { window = new mlx_window_handler; }
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ extern "C"
|
|||||||
mlx_window mlx_new_window(mlx_context mlx, const mlx_window_create_info* info)
|
mlx_window mlx_new_window(mlx_context mlx, const mlx_window_create_info* info)
|
||||||
{
|
{
|
||||||
MLX_CHECK_APPLICATION_POINTER(mlx);
|
MLX_CHECK_APPLICATION_POINTER(mlx);
|
||||||
return mlx->app->NewGraphicsSuport(info);
|
return mlx->app->NewGraphicsSupport(info);
|
||||||
}
|
}
|
||||||
|
|
||||||
void mlx_destroy_window(mlx_context mlx, mlx_window win)
|
void mlx_destroy_window(mlx_context mlx, mlx_window win)
|
||||||
@@ -90,6 +90,11 @@ extern "C"
|
|||||||
|
|
||||||
void mlx_set_window_title(mlx_context mlx, mlx_window win, const char* title)
|
void mlx_set_window_title(mlx_context mlx, mlx_window win, const char* title)
|
||||||
{
|
{
|
||||||
|
if (title == nullptr)
|
||||||
|
{
|
||||||
|
mlx::Error("invalid window title (NULL)");
|
||||||
|
return;
|
||||||
|
}
|
||||||
MLX_CHECK_APPLICATION_POINTER(mlx);
|
MLX_CHECK_APPLICATION_POINTER(mlx);
|
||||||
mlx::NonOwningPtr<mlx::GraphicsSupport> gs = mlx->app->GetGraphicsSupport(win);
|
mlx::NonOwningPtr<mlx::GraphicsSupport> gs = mlx->app->GetGraphicsSupport(win);
|
||||||
if(!gs && !gs->HasWindow())
|
if(!gs && !gs->HasWindow())
|
||||||
|
|||||||
Reference in New Issue
Block a user