Skip to content

Commit

Permalink
Merge pull request #231 from thinking-tower/bugfix/segfault-after-imp…
Browse files Browse the repository at this point in the history
…ort-kp-and-exit

Set kp_debug, kp_info, kp_warning and kp_error to py::none() when the program terminates.
  • Loading branch information
axsaucedo authored Jun 12, 2021
2 parents 6ffc934 + 0f84be9 commit e77a684
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions python/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,13 @@ PYBIND11_MODULE(kp, m) {
return kp::py::vkPropertiesToDict(properties);
}, "Return a dict containing information about the device");

auto atexit = py::module_::import("atexit");
atexit.attr("register")(py::cpp_function([](){
kp_debug = py::none();
kp_info = py::none();
kp_warning = py::none();
kp_error = py::none();
}));

#ifdef VERSION_INFO
m.attr("__version__") = VERSION_INFO;
Expand Down

0 comments on commit e77a684

Please sign in to comment.