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:
Flössie
2018-10-28 13:12:01 +01:00
parent 7038104a20
commit 5906329485
27 changed files with 708 additions and 697 deletions

View File

@@ -673,14 +673,16 @@ void Retinex::minmaxChanged (double cdma, double cdmin, double mini, double maxi
nextminT = Tmin;
nextmaxT = Tmax;
const auto func = [] (gpointer data) -> gboolean {
GThreadLock lock; // All GUI access from idle_add callbacks or separate thread HAVE to be protected
static_cast<Retinex*> (data)->minmaxComputed_();
const auto func =
[](Retinex* self) -> bool
{
GThreadLock lock; // All GUI access from idle_add callbacks or separate thread HAVE to be protected
// FIXME: The above can't be true?!
self->minmaxComputed_();
return false;
};
return FALSE;
};
idle_register.add (func, this);
idle_register.add<Retinex>(func, this, false);
}
bool Retinex::minmaxComputed_ ()