제가 말하는 건 wayland와 x11 구현을 담은 유니온인 unix.Window예요.
제가 완전히 놓친 건 오류가 크기 변경 이벤트 콜백 안에서 난다는 점이고, 그 콜백이 Window.init 중에 바로 호출되는 모양인데 저는 지금 초기화 중인 바로 그 윈도를 담을 변수를 읽고 있으니, 그게 이 문제를 설명하겠네요. 이것도… 마음에 썩 들지는 않는 설계 선택이지만, 괜찮은 다른 라이브러리를 아직 못 찾았어요.
윈도 변수 자체가 undefined라면 .backend 멤버를 읽는 순간 먼저 실패해야 할 것 같은데, 특히 유니온 접근에서 실패한다는 점이 좀 신기하네요?
영어에서 번역·원문 보기I'm referring specifically to unix.Window, a union containing wayland and x11 implementations.
What escaped me completely was that the error originates inside a resize event callback, which apparently runs straight away during Window.init, and I'm reading from the very variable which is intended to contain the window currently being initialized, so that would account for the problem I am seeing here. That's… another design choice I'm not especially keen on either, though I havent discovered any decent alternative libraries.
It seems rather curious that accessing the union specifically is where it fails, when the window variable itself contains undefined, wouldn't reading its .backend member already fail before that?