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 crash in StelTexture destructor on exit #3541

Merged
merged 1 commit into from Dec 10, 2023

Conversation

10110111
Copy link
Contributor

@10110111 10110111 commented Dec 9, 2023

On deletion of StelApp StelTextureMgr is deleted, after which some instances of StelTexture are deleted. But StelTexture destructor logs VRAM usage via StelTextureMgr, accessing a no longer existing object.

This commit turns the nonstatic raw pointer to texture manager into a static weak pointer (QPointer), so that it was possible to check whether texture manager still exists before trying to access it. Making it static is supposed to prevent useless copying of this smart pointer while the texture manager is effectively a singleton.

Fixes #3427

Copy link

github-actions bot commented Dec 9, 2023

Great PR! Please pay attention to the following items before merging:

Files matching src/**/*.cpp:

  • Are possibly unused includes removed?

This is an automatically generated QA checklist based on modified files.

@gzotti
Copy link
Member

gzotti commented Dec 9, 2023

Good find!

However, it may not have been all to solve. It still reported a crash.

image

@alex-w alex-w added this to the 23.4 milestone Dec 10, 2023
On deletion of StelApp StelTextureMgr is deleted, after which some
instances of StelTexture are deleted. But StelTexture destructor logs
VRAM usage via StelTextureMgr, accessing a no longer existing object.

This commit turns the nonstatic raw pointer to texture manager into a
static weak pointer (QPointer), so that it was possible to check whether
texture manager still exists before trying to access it. Making it
static is supposed to prevent useless copying of this smart pointer
while the texture manager is effectively a singleton.

Fixes Stellarium#3427
@10110111
Copy link
Contributor Author

The new version should fix this too.

@10110111
Copy link
Contributor Author

Did you update? It shouldn't even reach this line any more.

@alex-w
Copy link
Member

alex-w commented Dec 10, 2023

Did you update? It shouldn't even reach this line any more.

It was for previous code, let me check it again

Copy link
Member

@alex-w alex-w left a comment

Choose a reason for hiding this comment

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

Everything OK now, thanks!

@alex-w alex-w merged commit fc10e8e into Stellarium:master Dec 10, 2023
9 of 11 checks passed
@10110111 10110111 deleted the fix-texman-tex-crash-on-exit branch December 10, 2023 09:18
@gzotti
Copy link
Member

gzotti commented Dec 10, 2023

Confirmed also in W11. I wonder why it takes minutes to shutdown the application when running a debug session. But finally it came to an end without error.

@alex-w alex-w added the state: published The fix has been published for testing in weekly binary package label Dec 10, 2023
Copy link

Hello @10110111!

Please check the fresh version (development snapshot) of Stellarium:
https://github.com/Stellarium/stellarium-data/releases/tag/weekly-snapshot

@alex-w alex-w removed the state: published The fix has been published for testing in weekly binary package label Dec 23, 2023
Copy link

Hello @10110111!

Please check the latest stable version of Stellarium:
https://github.com/Stellarium/stellarium/releases/latest

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.

23.3: crash upon exit
3 participants