Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix resize crash #3107

Merged
merged 2 commits into from
Jun 10, 2024
Merged

Fix resize crash #3107

merged 2 commits into from
Jun 10, 2024

Conversation

matt335672
Copy link
Member

@matt335672 matt335672 commented Jun 3, 2024

Fixes a couple of problems with GFX resizing.

See #3105 for the background.

There's also detail on the commit comments about the changes.

The xrdp_enc_data contains a union for handling surface commands
and gfx commands. Memory processing is different for these two
options.

The default destructor for the encoder FIFO only knows about surface
commands. Consequently, if the encoder has queued GFX data when the
encoder is closed, the destructor processes the queued data as if
it contained surface commands rather than GFX commands. This typically
causes a SEGV as the drects field of the overlaid surface command
structure is not pointing at anything valid when it is freed.
On a resize, the encoder is deleted. At present this is done by asking
the encoder to exit, and then waiting a second.

- On slower systems, a second may not be enough, and so the encoder
  data structures are freed while they are still being used by the
  encoder.
- On quicker systems, resizes are delayed by hundreds of milliseconds
  longer than they need to be.

This commit adds a wait object which the encoder can use to signal it
has actually finished.
@@ -1457,6 +1470,7 @@ proc_enc_msg(void *arg)
}

} /* end while (cont) */
g_set_wait_obj(self->xrdp_encoder_term_done);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm honestly surprised this wasn't already here. Good fix!

@matt335672 matt335672 merged commit 6fa941e into neutrinolabs:devel Jun 10, 2024
14 checks passed
@matt335672 matt335672 deleted the fix_resize_crash branch June 10, 2024 17:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants