ContextImpl::currentContext contains a reference to one of the
DeviceInfoImpl objects from:
static std::vector<DeviceInfoImpl> global_devices;
ContextImpl::currentContext is destroyed in the destructor
for the statically defined object __module, and relies on its
DeviceInfoImpl reference to query some hardware features while
being destroyed.
This means that we need to ensure that the global_devices vector is
destroyed affter __module, otherwise ContextImpl::currentContext's
DeviceInfoImpl reference will no longer be valid when __module is
destroyed.
Since these variables are all confined to a single compilation unit,
they will be destruct from bottom to top, so we need to make sure
that __module is the bottom definition so it can be destroyed first.
This bug was triggered by Buildroot autobuilders [1,2], causing this
kind of failures [3,4]:
[ 14%] Building CXX object modules/core/CMakeFiles/opencv_core.dir/src/system.cpp.o
/home/test/autobuild/instance-0/output/build/opencv-2.4.10/modules/core/src/system.cpp: In function '(static initializers for /home/test/autobuild/instance-0/output/build/opencv-2.4.10/modules/core/src/system.cpp)':
/home/test/autobuild/instance-0/output/build/opencv-2.4.10/modules/core/src/system.cpp:280:10: error: inconsistent operand constraints in an 'asm'
make[3]: *** [modules/core/CMakeFiles/opencv_core.dir/src/system.cpp.o] Error 1
[1] http://buildroot.org/
[2] http://autobuild.buildroot.org/
[3] http://autobuild.buildroot.org/?reason=opencv-2.4.10
[4] http://autobuild.buildroot.org/results/483/4838285b25d6293a5cf0bb9eadd5040a7c75d766/build-end.log
Signed-off-by: Samuel Martin <s.martin49@gmail.com>
The current situation of the Gstreamer detection does not always honor
all the configurations set by the user, among this:
- if both WITH_GSTREAMER and WITH_GSTREAMER_0_10 are off, but
Gstreamer 0.10 is installed in the system, Gstreamer 0.10 support will
be enable;
- if both WITH_GSTREAMER and WITH_GSTREAMER_0_10 are on, only checks for
Gstreamer 0.10 will be run.
This patch fixes the Gstreamer detection like this:
| -DWITH_... | Package installed || OpenCV |
| GSTREAMER | GSTREAMER_0_10 | gst-1.x | gst-0.10 || gst. support |
+===========+================+=========+==========##==============+
| OFF | OFF | - | - || none |
| OFF | ON | - | no || none |
| OFF | ON | - | yes || gst-0.10 |
| ON | OFF | no | no || none |
| ON | OFF | no | yes || gst-0.10 |
| ON | OFF | yes | - || gst-1.x |
| ON | ON | yes | - || gst-1.x |
Signed-off-by: Samuel Martin <s.martin49@gmail.com>
Fixed the non-working code example for NAryMatIterator.
The documentation of NAryMatIterator in file:
modules/core/include/opencv2/core/core.hpp has a working example which
was used for these edits.