Skip to content

Display and control your Android device

Fix segfault on close with --no-video

Romain Vimontaa34d63171c8
diff --git a/app/src/scrcpy.c b/app/src/scrcpy.c
index f43af35e..537562f4 100644
--- a/app/src/scrcpy.c
+++ b/app/src/scrcpy.c
@@ -805,9 +805,12 @@ scrcpy(struct scrcpy_options *options) {
ret = event_loop(s);
LOGD("quit...");
- // Close the window immediately on closing, because screen_destroy() may
- // only be called once the video demuxer thread is joined (it may take time)
- sc_screen_hide_window(&s->screen);
+ if (options->video_playback) {
+ // Close the window immediately on closing, because screen_destroy()
+ // may only be called once the video demuxer thread is joined (it may
+ // take time)
+ sc_screen_hide_window(&s->screen);
+ }
end:
if (timeout_started) {