mirror of
https://github.com/Genymobile/scrcpy.git
synced 2025-04-19 19:15:08 +00:00
Fix segfault on SDL event without window
Since #5804, controls have been enabled even with --no-window. As a result, the Android clipboard is synchronized with the computer, causing SDL to trigger an SDL_CLIPBOARDUPDATE event. This event is ignored by scrcpy, but it was still transmitted to the sc_screen instance, even if it had not been initialized. Fix the issue by calling sc_screen_handle_event() only when a screen instance exists. Refs #5804 <https://github.com/Genymobile/scrcpy/pull/5804> Fixes #5970 <https://github.com/Genymobile/scrcpy/issues/5970>
This commit is contained in:
parent
db9dc6ae83
commit
882003f314
1 changed files with 3 additions and 3 deletions
|
@ -165,7 +165,7 @@ sdl_configure(bool video_playback, bool disable_screensaver) {
|
|||
}
|
||||
|
||||
static enum scrcpy_exit_code
|
||||
event_loop(struct scrcpy *s) {
|
||||
event_loop(struct scrcpy *s, bool has_screen) {
|
||||
SDL_Event event;
|
||||
while (SDL_WaitEvent(&event)) {
|
||||
switch (event.type) {
|
||||
|
@ -197,7 +197,7 @@ event_loop(struct scrcpy *s) {
|
|||
break;
|
||||
}
|
||||
default:
|
||||
if (!sc_screen_handle_event(&s->screen, &event)) {
|
||||
if (has_screen && !sc_screen_handle_event(&s->screen, &event)) {
|
||||
return SCRCPY_EXIT_FAILURE;
|
||||
}
|
||||
break;
|
||||
|
@ -933,7 +933,7 @@ aoa_complete:
|
|||
}
|
||||
}
|
||||
|
||||
ret = event_loop(s);
|
||||
ret = event_loop(s, options->window);
|
||||
terminate_event_loop();
|
||||
LOGD("quit...");
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue