Skip to content

Commit

Permalink
fix (mvFileDialog): Need an INCREF on cancel_callback #2148
Browse files Browse the repository at this point in the history
  • Loading branch information
v-ein authored and hoffstadt committed Aug 18, 2023
1 parent 4b0b913 commit c53a4c5
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/mvFileDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,18 @@ void mvFileDialog::handleSpecificKeywordArgs(PyObject* dict)
_max_size = { (float)max_size[0], (float)max_size[1] };
}

if (PyObject* item = PyDict_GetItemString(dict, "cancel_callback")) _cancelCallback = item;
if (PyObject* item = PyDict_GetItemString(dict, "cancel_callback"))
{
Py_XDECREF(_cancelCallback);

if (item == Py_None)
_cancelCallback = nullptr;
else
{
Py_XINCREF(item);
_cancelCallback = item;
}
}

}

Expand Down

0 comments on commit c53a4c5

Please sign in to comment.