Gui: Fix crash in QuarterWidgetP::removeFromCacheContext
Fixes #https://github.com/FreeCAD/FreeCAD/issues/14988
This commit is contained in:
@@ -169,13 +169,22 @@ QuarterWidgetP::removeFromCacheContext(QuarterWidgetP_cachecontext * context, co
|
||||
|
||||
for (int i = 0; i < cachecontext_list->getLength(); i++) {
|
||||
if ((*cachecontext_list)[i] == context) {
|
||||
// set the context while calling destructingContext() (might trigger OpenGL calls)
|
||||
const_cast<QtGLWidget*> (widget)->makeCurrent();
|
||||
// fetch the cc_glglue context instance as a workaround for a bug fixed in Coin r12818
|
||||
(void) cc_glglue_instance(context->id);
|
||||
QtGLContext* glcontext = widget->context();
|
||||
if (glcontext) {
|
||||
// set the context while calling destructingContext() (might trigger OpenGL calls)
|
||||
if (glcontext->isValid()) {
|
||||
const_cast<QtGLWidget*> (widget)->makeCurrent();
|
||||
}
|
||||
// fetch the cc_glglue context instance as a workaround for a bug fixed in Coin r12818
|
||||
(void) cc_glglue_instance(context->id);
|
||||
}
|
||||
cachecontext_list->removeFast(i);
|
||||
SoContextHandler::destructingContext(context->id);
|
||||
const_cast<QtGLWidget*> (widget)->doneCurrent();
|
||||
if (glcontext) {
|
||||
if (glcontext->isValid()) {
|
||||
const_cast<QtGLWidget*> (widget)->doneCurrent();
|
||||
}
|
||||
}
|
||||
delete context;
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user