Repository: opencv
Issue: openCV DNN:: cv::ocl::Queue segfault 'scalar deleting destructor' [OpenCL]
Labels: bug,category: core,category: ocl,platform: win32

##### System information (version) #################
- OpenCV => 4.3
- Operating System / Platform => Windows 10, 64 Bit
- Compiler => Visual Studio 2019

##### Detailed description #################

When running a SSD-MobileNet v2 converted from Tensorflow model (pb) using the DNN module. It gives out a result and throws a segfault in the destructor.

` objectDetectionNet.setInput(blob);
  cv::Mat output = objectDetectionNet.forward();`
 
Throws a segfault error.
I could see a [INFO] message that OpenCL is initialized. Hardware is Intel HD graphics.

###########  ############

PID 10620 received SIGSEGV for address: 0x718ffb65
OS-Version: 10.0.18362 () 0x100-0x1
00007FFF719385B6 (ntdll): (filename not available): RtlIsGenericTableEmpty
00007FFF7192A056 (ntdll): (filename not available): RtlRaiseException
00007FFF7195FE3E (ntdll): (filename not available): KiUserExceptionDispatcher
00007FFF718FFB65 (ntdll): (filename not available): RtlFreeHeap
00007FFF34B3078C (igdrcl64): (filename not available): clGetCLObjectInfoINTEL
00007FFF34B1E4BE (igdrcl64): (filename not available): clGetCLObjectInfoINTEL
00007FFF3491B634 (igdrcl64): (filename not available): (function-name not available)
00007FFF349197D9 (igdrcl64): (filename not available): (function-name not available)
00007FFF34919284 (igdrcl64): (filename not available): (function-name not available)
00007FFF34903D02 (igdrcl64): (filename not available): (function-name not available)
00007FFF34927876 (igdrcl64): (filename not available): (function-name not available)
D:\cosmos\libs\opencv-4.3.0\modules\core\src\opencl\runtime\autogenerated\opencl_core_impl.hpp (391): OPENCL_FN_clFinish_switch_fn
D:\cosmos\libs\opencv-4.3.0\modules\core\src\ocl.cpp (2656): cv::ocl::Queue::Impl::~Impl
00007FFF0DD90E0C (SiviVision): (filename not available): cv::ocl::Queue::Impl::`scalar deleting destructor'
D:\cosmos\libs\opencv-4.3.0\modules\core\src\ocl.cpp (2689): cv::ocl::Queue::Impl::release
D:\cosmos\libs\opencv-4.3.0\modules\core\src\ocl.cpp (2728): cv::ocl::Queue::~Queue
00007FFF0DB9E5EF (SiviVision): (filename not available): cv::CoreTLSData::~CoreTLSData
00007FFF0DB9F81C (SiviVision): (filename not available): cv::CoreTLSData::`scalar deleting destructor'
D:\cosmos\libs\opencv-4.3.0\modules\core\include\opencv2\core\utils\tls.hpp (80): cv::TLSData<cv::CoreTLSData>::deleteDataInstance
D:\cosmos\libs\opencv-4.3.0\modules\core\src\system.cpp (1543): cv::details::TlsStorage::releaseThread
D:\cosmos\libs\opencv-4.3.0\modules\core\src\system.cpp (1719): cv::details::opencv_fls_destructor
00007FFF719340C9 (ntdll): (filename not available): RtlFlsFree
00007FFF6F2DAA7B (KERNELBASE): (filename not available): FlsFree
D:\cosmos\libs\opencv-4.3.0\modules\core\src\system.cpp (1442): cv::details::TlsAbstraction::~TlsAbstraction
00007FFF106CC3F1 (SiviVision): (filename not available): `cv::details::getTlsAbstraction_'::`2'::`dynamic atexit destructor for 'g_tls''
minkernel\crts\ucrt\src\appcrt\startup\onexit.cpp (206): <lambda_d121dba8a4adeaf3a9819e48611155df>::operator()
vccrt\vcruntime\inc\internal_shared.h (204): __crt_seh_guarded_call<int>::operator()<<lambda_6a47f4c8fd0152770a780fc1d70204eb>,<lambda_d121dba8a4adeaf3a9819e48611155df> &,<lambda_6aaa2265f5b6a89667e7d7630012e97a> >
minkernel\crts\ucrt\inc\corecrt_internal.h (975): __acrt_lock_and_call<<lambda_d121dba8a4adeaf3a9819e48611155df> >
minkernel\crts\ucrt\src\appcrt\startup\onexit.cpp (231): _execute_onexit_table
minkernel\crts\ucrt\src\appcrt\startup\exit.cpp (226): <lambda_6e4b09c48022b2350581041d5f6b0c4c>::operator()
vccrt\vcruntime\inc\internal_shared.h (224): __crt_seh_guarded_call<void>::operator()<<lambda_d80eeec6fff315bfe5c115232f3240e3>,<lambda_6e4b09c48022b2350581041d5f6b0c4c> &,<lambda_2358e3775559c9db80273638284d5e45> >
minkernel\crts\ucrt\inc\corecrt_internal.h (975): __acrt_lock_and_call<<lambda_6e4b09c48022b2350581041d5f6b0c4c> >
minkernel\crts\ucrt\src\appcrt\startup\exit.cpp (259): common_exit
minkernel\crts\ucrt\src\appcrt\startup\exit.cpp (314): _cexit
d:\A01\_work\6\s\src\vctools\crt\vcstartup\src\utility\utility.cpp (407): __scrt_dllmain_uninitialize_c
d:\A01\_work\6\s\src\vctools\crt\vcstartup\src\startup\dll_dllmain.cpp (182): dllmain_crt_process_detach
d:\A01\_work\6\s\src\vctools\crt\vcstartup\src\startup\dll_dllmain.cpp (220): dllmain_crt_dispatch
d:\A01\_work\6\s\src\vctools\crt\vcstartup\src\startup\dll_dllmain.cpp (293): dllmain_dispatch
d:\A01\_work\6\s\src\vctools\crt\vcstartup\src\startup\dll_dllmain.cpp (335): _DllMainCRTStartup
00007FFF718E5021 (ntdll): (filename not available): RtlActivateActivationContextUnsafeFast
00007FFF7192AA82 (ntdll): (filename not available): LdrShutdownProcess
00007FFF7192A92D (ntdll): (filename not available): RtlExitUserProcess
00007FFF6FE1CD8A (KERNEL32): (filename not available): ExitProcess
00007FF702271B49 (node): (filename not available): v8::internal::SetupIsolateDelegate::SetupHeap
00007FF702271AFF (node): (filename not available): v8::internal::SetupIsolateDelegate::SetupHeap
00007FF702245DBF (node): (filename not available): v8::internal::SetupIsolateDelegate::SetupHeap
00007FFF6FE17BD4 (KERNEL32): (filename not available): BaseThreadInitThunk
00007FFF7192CE51 (ntdll): (filename not available): RtlUserThreadStart