Skip to content

fix: Add NULL check to GLFWwindow*#1329

Merged
Reputeless merged 1 commit intoSiv3D:v6_developfrom
sthairno:macos-add-null-check-ctextinput
Jan 10, 2026
Merged

fix: Add NULL check to GLFWwindow*#1329
Reputeless merged 1 commit intoSiv3D:v6_developfrom
sthairno:macos-add-null-check-ctextinput

Conversation

@sthairno
Copy link
Copy Markdown
Member

What

Mac版のCTextInput::init()にGLFWwindow*のNULLチェックを追加

Why

HeadlessモードではSIV3D_ENGINE(Window)->getHandle()がNULLを返してしまい、後続のglfwSetCharCallbackの内部でassertionエラーが発生していました。Linux版のコードではNULLだった場合呼び出しをしていなかったため同様の対応をしました。

void CTextInput::init()
{
LOG_SCOPED_TRACE(U"CTextInput::init()");
if (GLFWwindow* glfwWindow = static_cast<GLFWwindow*>(SIV3D_ENGINE(Window)->getHandle()))
{
::glfwSetCharCallback(glfwWindow, OnCharacterInput);
}
}

How to test

Headlessモードを有効にしたMain.cppでクラッシュしないこと

# include <Siv3D.hpp> // Siv3D v0.6.16

SIV3D_SET(EngineOption::Renderer::Headless)

void Main()
{
	
}

@Reputeless Reputeless moved this to ToDo in v0.6 Roadmap Jan 10, 2026
@Reputeless Reputeless merged commit 339bde7 into Siv3D:v6_develop Jan 10, 2026
1 check passed
@github-project-automation github-project-automation Bot moved this from ToDo to Done in v0.6 Roadmap Jan 10, 2026
@Reputeless
Copy link
Copy Markdown
Member

Merged. Thanks!

@sthairno sthairno deleted the macos-add-null-check-ctextinput branch January 10, 2026 04:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants