Review IdleRegister
(#4892)
This turns `IdleRegister::add()` into a template function to make the provided function pointers type safe. It also adds a `delete_data` parameter to manage the provided data pointer even in `destroy()`.
This commit is contained in:
@@ -233,31 +233,29 @@ void FileBrowserEntry::updateImage(rtengine::IImage8* img, double scale, const r
|
||||
|
||||
const gint priority = G_PRIORITY_LOW;
|
||||
|
||||
const auto func = [](gpointer data) -> gboolean {
|
||||
tiupdate* const params = static_cast<tiupdate*>(data);
|
||||
FileBrowserEntryIdleHelper* const feih = params->feih;
|
||||
const auto func =
|
||||
[](tiupdate* params) -> bool
|
||||
{
|
||||
FileBrowserEntryIdleHelper* const feih = params->feih;
|
||||
|
||||
if (feih->destroyed) {
|
||||
if (feih->pending == 1) {
|
||||
delete feih;
|
||||
} else {
|
||||
feih->pending--;
|
||||
if (feih->destroyed) {
|
||||
if (feih->pending == 1) {
|
||||
delete feih;
|
||||
} else {
|
||||
feih->pending--;
|
||||
}
|
||||
|
||||
params->img->free ();
|
||||
return false;
|
||||
}
|
||||
|
||||
params->img->free ();
|
||||
delete params;
|
||||
return 0;
|
||||
}
|
||||
feih->fbentry->_updateImage (params->img, params->scale, params->cropParams);
|
||||
feih->pending--;
|
||||
|
||||
feih->fbentry->_updateImage (params->img, params->scale, params->cropParams);
|
||||
feih->pending--;
|
||||
return false;
|
||||
};
|
||||
|
||||
delete params;
|
||||
|
||||
return FALSE;
|
||||
};
|
||||
|
||||
idle_register.add(func, param, priority);
|
||||
idle_register.add<tiupdate>(func, param, true, priority);
|
||||
}
|
||||
|
||||
void FileBrowserEntry::_updateImage(rtengine::IImage8* img, double s, const rtengine::procparams::CropParams& cropParams)
|
||||
|
Reference in New Issue
Block a user