Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 232e562

Browse files
committed
Call super().destroy() in _maxosx.m FigureManager
1 parent b42ce64 commit 232e562

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

src/_macosx.m

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -572,6 +572,8 @@ bool mpl_check_modifier(bool present, PyObject* list, char const* name)
572572
},
573573
};
574574

575+
static PyTypeObject FigureManagerType;
576+
575577
typedef struct {
576578
PyObject_HEAD
577579
Window* window;
@@ -686,7 +688,24 @@ bool mpl_check_modifier(bool present, PyObject* list, char const* name)
686688
{
687689
[self->window close];
688690
self->window = NULL;
689-
[super destroy];
691+
692+
// call super().destroy()
693+
PyObject *super_obj = PyObject_CallFunctionObjArgs(
694+
(PyObject *)&PySuper_Type,
695+
(PyObject *)FigureManagerType,
696+
self,
697+
NULL
698+
);
699+
if (super_obj == NULL) {
700+
return NULL; // error
701+
}
702+
PyObject *result = PyObject_CallMethod(super_obj, "destroy", NULL);
703+
Py_DECREF(super_obj);
704+
if (result == NULL) {
705+
return NULL; // error
706+
}
707+
Py_DECREF(result);
708+
690709
Py_RETURN_NONE;
691710
}
692711

0 commit comments

Comments
 (0)