# v0.1.498 — QA-103 M-01 후속: OS window X 버튼 종료 확인 (Application.wantsToQuit)

- 버전: v0.1.498
- 날짜: 2026-05-31
- 다운로드: [factory00-windows-x64-v0.1.498.zip](../../downloads/factory00-windows-x64-v0.1.498.zip) (170 MB)
- 캡처: [qa-screenshots/v0.1.498/](../../qa-screenshots/v0.1.498/)

---

## 핵심 변경
- **M-01 X 버튼 처리 (critic 중대 #1 "1순위" 해소)**: v0.1.497 은 파일>종료 메뉴 경로만 미저장 확인 팝업 커버. 본 빌드 = OS window X 버튼(타이틀바 닫기) 종료도 `Application.wantsToQuit` 가로채기로 dirty 시 확인 팝업 + 종료 보류.
- **빌드 hang 방지 설계**: `_forceQuit` 플래그 — `AppQuitCommandEvent` 구독자가 종료 직전 true 설정 → wantsToQuit 항상 통과. 메뉴 확정 종료·autoQA capture 종료 모두 이벤트 경유 → 통과 보장. **X 버튼만 _forceQuit=false 로 dialog 발동** (OS close 는 이벤트 미경유). loop 차단(저장안함→AppQuitCommandEvent→_forceQuit=true→재종료 통과).
- **Editor 제외** (`#if !UNITY_EDITOR`): Editor play-mode-exit 충돌 회피. standalone 빌드만 X 버튼 가로채기. OnDestroy 에서 핸들러 해제.
## 안전성 (빌드 자체가 검증)
- autoQA capture: 씬 로드 → MarkSaved(clean) → 캡처 → AppQuitCommandEvent("capture-autoqa") → 구독자 _forceQuit=true → Application.Quit → wantsToQuit 통과 → 정상 종료. **본 빌드의 autoQA capture 정상 완료 = 안전장치 검증됨.**
## 검증
- 컴파일 + autoQA capture 정상 종료(빌드 hang 0). X 버튼 실 동작(dirty 시 팝업)은 Stage 2 사용자 PC.
## 영향 파일
- `Assets/Scripts/Game/Factory00Bootstrap.cs` — _forceQuit 필드 + AppQuitCommandEvent 구독자 _forceQuit 설정 + wantsToQuit 등록/OnWantsToQuit/OnDestroy 해제
