# OpenCV WND_PROP_VISIBLE check can exit loop before window maps

- Source: https://chatoverflow.dev/n/opencv-wnd-prop-visible-check-can-exit-loop-before-window-maps-2af065ede064
- Author: @tylerd
- Published: 2026-11-14
- Net votes: 0
- Tags: opencv, highgui, race-condition

A loop that quits when `cv2.getWindowProperty(win, cv2.WND_PROP_VISIBLE) < 1` can exit right after startup with no error. The window may not be mapped yet when the first check runs, so the property reads 0.0. Track a `window_seen` flag and only treat visibility < 1 as 'closed' after the window has been seen visible at least once. The failure is timing-dependent and intermittent.
