Browse Source

python: properly provide virtual destructors for Application classes.

This time I actually have to thank you, Clang.
pull/2/head
Vladimír Vondruš 7 years ago
parent
commit
d36aa31a37
  1. 4
      src/python/magnum/platform/egl.cpp
  2. 4
      src/python/magnum/platform/glfw.cpp
  3. 4
      src/python/magnum/platform/glx.cpp
  4. 4
      src/python/magnum/platform/sdl2.cpp

4
src/python/magnum/platform/egl.cpp

@ -58,6 +58,10 @@ void egl(py::module& m) {
#pragma GCC diagnostic pop #pragma GCC diagnostic pop
#endif #endif
} }
/* The base doesn't have a virtual destructor because in C++ it's never
deleted through a pointer to the base. Here we need it, though. */
virtual ~PyWindowlessApplication() {}
}; };
py::class_<PyWindowlessApplication> windowlessEglApplication{m, "WindowlessApplication", "Windowless EGL application"}; py::class_<PyWindowlessApplication> windowlessEglApplication{m, "WindowlessApplication", "Windowless EGL application"};

4
src/python/magnum/platform/glfw.cpp

@ -45,6 +45,10 @@ void glfw(py::module& m) {
void mousePressEvent(MouseEvent&) override {} void mousePressEvent(MouseEvent&) override {}
void mouseReleaseEvent(MouseEvent&) override {} void mouseReleaseEvent(MouseEvent&) override {}
void mouseMoveEvent(MouseMoveEvent&) override {} void mouseMoveEvent(MouseMoveEvent&) override {}
/* The base doesn't have a virtual destructor because in C++ it's never
deleted through a pointer to the base. Here we need it, though. */
virtual ~PublicizedApplication() {}
}; };
struct PyApplication: PublicizedApplication { struct PyApplication: PublicizedApplication {

4
src/python/magnum/platform/glx.cpp

@ -58,6 +58,10 @@ void glx(py::module& m) {
#pragma GCC diagnostic pop #pragma GCC diagnostic pop
#endif #endif
} }
/* The base doesn't have a virtual destructor because in C++ it's never
deleted through a pointer to the base. Here we need it, though. */
virtual ~PyWindowlessApplication() {}
}; };
py::class_<PyWindowlessApplication> windowlessGlxApplication{m, "WindowlessApplication", "Windowless GLX application"}; py::class_<PyWindowlessApplication> windowlessGlxApplication{m, "WindowlessApplication", "Windowless GLX application"};

4
src/python/magnum/platform/sdl2.cpp

@ -45,6 +45,10 @@ void sdl2(py::module& m) {
void mousePressEvent(MouseEvent&) override {} void mousePressEvent(MouseEvent&) override {}
void mouseReleaseEvent(MouseEvent&) override {} void mouseReleaseEvent(MouseEvent&) override {}
void mouseMoveEvent(MouseMoveEvent&) override {} void mouseMoveEvent(MouseMoveEvent&) override {}
/* The base doesn't have a virtual destructor because in C++ it's never
deleted through a pointer to the base. Here we need it, though. */
virtual ~PublicizedApplication() {}
}; };
struct PyApplication: PublicizedApplication { struct PyApplication: PublicizedApplication {

Loading…
Cancel
Save