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

swapping textures crashes if replaced texture was last reference #70

Open
bloerwald opened this issue Nov 17, 2020 · 2 comments
Open

swapping textures crashes if replaced texture was last reference #70

bloerwald opened this issue Nov 17, 2020 · 2 comments

Comments

@bloerwald
Copy link
Contributor

If the replaced texture is the last instance of that texture, it will be erased within the slot, leading to a glDeleteTextures() without active context.

VCRUNTIME140                                  CxxThrowException
opengl\context.cpp (57)                       opengl::`anonymous namespace'::verify_context_and_check_for_gl_errors::verify_context_and_check_for_gl_errors
opengl\context.cpp (285)                      opengl::context::deleteTextures
opengl\texture.cpp (20)                       opengl::texture::~texture
                                              std::map<std::string,blp_texture>::_Erase_unchecked
noggit\multimap_with_normalized_key.hpp (89)  noggit::async_object_multimap_with_normalized_key<blp_texture>::erase
Qt5Core                                       QtPrivate::QFunctorSlotObject<<lambda_1f883b93a2eca3bd8ea76fc535a6773d>,0,QtPrivate::List<>,void>::impl
Qt5Core                                       QMetaObject::activate
Qt5Widgets                                    QAbstractButton::clicked
@bloerwald
Copy link
Contributor Author

Also when clicking Select. tldr: check all buttons for context. tlldr: we should lazily delete textures in the next render loop instead of directly.

@bkleiner
Copy link
Contributor

bkleiner commented Mar 8, 2021

#58 and #12 are similar.
in recent years a pattern in (multithreaded) engines has emerged where gpu commands are collected in different threads (command buffers) and are then submitted to the gpu as batches in one or multiple render threads.
something along those lines would avoid all situations where currently makeCurrent() is called. big change tho.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants