Question 1:
Let’s say OMX_Init returned with error (OMX_ErrorInsufficientResources). Can I & should I call OMX_Deinit?
Question 2:
Some program (under linux) dynamically loads some OMX_IL library by dlopen and dlsym. Then calls OMX_Init which returns with OMX_ErrorInsufficientResources error. Then program tries to unload OMX_IL library by dlclose, but for some reasons library doesn’t unload and stays in half-initialized state. Then program repeats its algorithm: calls dlopen, dlsym and OMX_Init, but library returns with OMX_ErrorNone and still stays in half-initialized state. Then program calls OMX_ComponentNameEnum and library segfaults because of half-initialized state. So how’s wrong? Program which doesn’t call OMX_Deinit and expects that library unloads by dlclose and all local static variables will cleared and library will not stay in half-initialized state. Or library which doesn’t unload by dlclose for some reasons?
(For clearness, program is vlc-2.1.5, OMX_IL library is libomxil-bellagio-0.9.3)
>>Question 1:
Spec does not detail about error conditions/handling.
I would expect if OMX_Init is not success, then OMX_Deinit is not necessary.
>>Question 2:
Probably i understand the problem, although have not looked into Bellagio.
Library constructors are called at the load time, and if the library is already loaded/opened, obviously constructor would not be called again.
A ‘fix’ could be to have a variable which tells if init has been successful.
Hope this help.