GNOME Bugzilla – Bug 778020
opencv: Don't store C++ types directly in C structs
Last modified: 2017-05-20 14:24:49 UTC
See commit 718c4140fac99c2fa7cdb25860566d2d9fa0eec3 Author: Sebastian Dröge <sebastian@centricular.com> Date: Wed Feb 1 13:44:37 2017 +0200 dewarp: Store C++ types as pointers in C structs Otherwise the destructor will never be called, and we would have to call the constructors manually at some point... which we never did, so calling release() on it before it got otherwise initialized caused a crash. For example when running gst-inspect-1.0.
Do we have the same issue in the other OpenCV plugins? Just asking in case you know. If you don't, I can investigate.
I don't know, the others are not crashing like that but someone will have to check all struct definitions to ensure there's only pointers to C++ types there.
I should look into it and be sure.
These look suspicious: MotionCells.h: vector < MotionCellsIdx > m_MotionCells; MotionCells.h: vector < OverlayRegions > m_OverlayRegions; MotionCells.h: MotionCellHeader m_header; These might be ok: gstdisparity.h: cv::Ptr<cv::StereoBM> sbm; gstdisparity.h: cv::Ptr<cv::StereoSGBM> sgbm; gstsegmentation.h: cv::Ptr<cv::BackgroundSubtractor> mog; gstsegmentation.h: cv::Ptr<cv::BackgroundSubtractorMOG2> mog2; ?
The stuff in MotionCells.h is in a C++ class struct, so ok. Rest has explicit delete/release calls, so fine as well. I think this can be closed then.