Page MenuHomePhabricator

Crash in the OpenCL resource Service when accessing the CommandQueue before the Context
Closed, ResolvedPublic

Description

When accessing the commandQueue getter of the OpenCLResourceservice before the context getter was accessed the program finishes with a segmentation fault.

Example:

ServiceReference ref = GetModuleContext()->GetServiceReference<OclResourceService>();
OclResourceService* resources = GetModuleContext()->GetService<OclResourceService>(ref);
m_context = resources->GetContext();
m_CommandQue = resources->GetCommandQueue()

This is quite obvious because the commandQueue needs to be initialized with a valid context, and the context is only initialized when it is accessed.

Proposal:

Check in the command queue getter if the contextcollection is initialized. If not initialize the collection. That will prevent from crashing.

Event Timeline

New remote branch pushed: bug-15408-OclCommandQueueCrash

[fc1925]: Merge branch 'bug-15408-OclCommandQueueCrash'

Merged commits:

2013-06-19 13:38:53 Eric Heim [31ad4c]
check if there is an opencl context collection and create one to prevent to create a command queue without a context