Unfortunatelly my big post is lost because forum request to login again. So will be short.
I had time to more precise review of 1534. I didn't check new modules (grid,zebra,mdetect) but have few significant notes for other code:
1. What is purpose of addition to module_load.c below?
278 if ( callback )
279 callback( (void**) modules[idx]->_module_exportlist );
This if case mean "module load request but module is already loaded". Only one additional things that we need is sanity unload request (module is unloaded ~40 msec after this is requested) so it is theoretically possible situation when module request for its unload, but something in other thread request its loading right after.
But no re-binding required because module is already binded.
2. Most libraries could be safely unloaded automatically (they just will be loaded again when reqiured) but some of them can't.
In which conditions could happens automatical unloading:
a) When gui mode switched to GUI_MODE_NONE then core unload all modules without MODULE_FLAG_DISABLE_AUTOUNLOAD flag
b) When user leave module submenu then module also is unloaded.
What bad thing happens:
a) DNG library. MODULE_FLAG_DISABLE_AUTOUNLOAD is cleaned so it will be unloaded after user go to menu or just alt mode.
Bad things happened:
- badpixel file is loaded only on CHDK start(config read) or dng bool menu item switched. So it will be lost and no badpixel removal will be applied to following raws.
- perfomance impact (library will be loaded inside shooting process instead of loading on start+ possible loading badpixel in _module_loader to fix first problem also take time and use probably unsafe fopen)
b) EDGEOVR. Shouldn't be unloaded ever. But it will be when enter and leave its submenu
Bad things happened:
- Current edge picture will be lost (release_1_0 never lost this picture. even if turn off edgeovr temporary)
- Memory leak because no free allocated resources in _module_unloader
Simple solution: Move edgebuf into core
3. That is correct that mdetect.flt have MODULE_FLAG_DISABLE_AUTOUNLOAD because it unsafe if it will be unloaded in progress.
I'm not sure why did you set flag MODULE_FLAG_DISABLE_AUTOUNLOAD for zebra, but would like to note just in case that this flag will not prevent unloading when leave its submenu.
But I'm not sure I can see a reason why you would ever want to script any of the internal settings for any of the modules I've updated (sokoban level, zebra colors, etc).
I do agree that this is uncommon case