···117117 struct gui_ogl_sink *s = container_of(tex, struct gui_ogl_sink, tex);
118118 (void)s;
119119120120- // Take the frame no need to adjust reference.
121120 pthread_mutex_lock(&s->mutex);
122122- struct xrt_frame *frame = s->frame;
123123- s->frame = NULL;
121121+122122+ struct xrt_frame *frame = NULL;
123123+124124+ // Only take the frame if we are running.
125125+ if (s->running) {
126126+ // Take the frame no need to adjust reference.
127127+ frame = s->frame;
128128+ s->frame = NULL;
129129+ }
130130+124131 pthread_mutex_unlock(&s->mutex);
125132126133 if (frame == NULL) {
127134 return;
128135 }
129136130130- // To large stride for GLint.
137137+ /*
138138+ * The frame properties are immutable while it is alive,
139139+ * so no need to take any locks while reading them.
140140+ */
141141+142142+ // Too large of stride for GLint.
131143 if (frame->stride > INT_MAX) {
132132- U_LOG_E("Stride unreasonable large!");
144144+ U_LOG_E("Stride unreasonably large!");
133145 return;
134146 }
135147