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

CDROM_Interface pointer ownership issue #3620

Closed
3 tasks done
japsmits opened this issue Apr 18, 2024 · 2 comments · Fixed by #3634
Closed
3 tasks done

CDROM_Interface pointer ownership issue #3620

japsmits opened this issue Apr 18, 2024 · 2 comments · Fixed by #3634
Assignees
Labels
bug Something isn't working

Comments

@japsmits
Copy link
Collaborator

Are you using the latest Dosbox-Staging Version?

  • I have checked releases and am using the latest release.

Different version than latest?

Git

What Operating System are you using?

Windows 10

If Other OS, please describe

No response

Relevant hardware info

No response

Have you checked that no other similar issue already exists?

  • I have searched and not found similar issues.

A clear and concise description of what the bug is.

The pointer created by new CDROM_Interface_Image gets stored in two places (CDROM_Interface_Image::images and CMmscdex::cdrom) and can get deleted in both places. This is undefined behaviour.

Steps to reproduce the behaviour.

Explain how to reproduce

  1. Code inspection...

Download URL of affected game or software

No response

Your configuration

No response

Provide a Log

No response

Code of Conduct & Contributing Guidelines

  • Yes, I agree.
@japsmits japsmits added the bug Something isn't working label Apr 18, 2024
@japsmits japsmits self-assigned this Apr 18, 2024
@japsmits
Copy link
Collaborator Author

Working on a not-too-invasive solution of this. Basically, one owning store for all CDROM_Interface decedents.

@japsmits japsmits changed the title CDROM_Interface pointership issue CDROM_Interface pointer ownership issue Apr 18, 2024
@weirddan455
Copy link
Collaborator

I'd suggest either adding some (temporary) log statements or setting a debugger breakpoint to confirm a double free happens in practice. Actual behavior can often be surprising.

Either way, a cleanup of this would be welcome though.

@japsmits japsmits linked a pull request Apr 25, 2024 that will close this issue
10 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants