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

AGS: Fix seg fault in Dreams in Witch House #4812

Closed
wants to merge 1 commit into from

Conversation

antoniou79
Copy link
Contributor

Reported here https://bugs.scummvm.org/ticket/14338

Please review. This line fixes the issue, and I don't see any obvious side-effects, but someone with better knowledge of the engine should approve or dismiss the fix.

@antoniou79 antoniou79 requested a review from criezy March 16, 2023 11:20
@tag2015
Copy link
Contributor

tag2015 commented Mar 18, 2023

This segfault is fixed in the recent upstream commits that reworked the SpriteBatches, but since those cause some regressions (even with the upstream interpreter) with old games, I'm not too sure we should merge those already (or at all).
This fix seems fine to me.

@criezy
Copy link
Member

criezy commented Mar 27, 2023

I was a bit worried about the potential impact of this change. So I pushed a different fix instead in 4283861.

As I see it the main issue was that a double-free happened on a Bitmap object because a static_pointer_cast was used to copy the Bitmap from one std::shared_ptr<Bitmap> to another. That mean that two separate std::shared_ptr were pointing to the same Bitmap object using a different tracker. It seems to me that the proper way to fix is to use the std::shared_ptr::operator=() to do the copy, and this is the change I committed.

@criezy criezy closed this Mar 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants