Omit GThreadLock and use IdleRegister in WhiteBalance (fixes #4545)

This commit is contained in:
Flössie
2018-05-10 20:21:12 +02:00
parent 318c92a475
commit 22274f2efd
2 changed files with 35 additions and 12 deletions

View File

@@ -349,6 +349,10 @@ WhiteBalance::WhiteBalance () : FoldableToolPanel(this, "whitebalance", M("TP_WB
spotsize->signal_changed().connect( sigc::mem_fun(*this, &WhiteBalance::spotSizeChanged) );
}
WhiteBalance::~WhiteBalance()
{
idle_register.destroy();
}
void WhiteBalance::enabledChanged()
{
@@ -895,12 +899,28 @@ inline Gtk::TreeRow WhiteBalance::getActiveMethod ()
void WhiteBalance::WBChanged(double temperature, double greenVal)
{
GThreadLock lock;
disableListener();
setEnabled(true);
temp->setValue(temperature);
green->setValue(greenVal);
temp->setDefault(temperature);
green->setDefault(greenVal);
enableListener();
struct Data {
WhiteBalance* self;
double temperature;
double green_val;
};
const auto func = [](gpointer data) -> gboolean {
WhiteBalance* const self = static_cast<WhiteBalance*>(static_cast<Data*>(data)->self);
const double temperature = static_cast<Data*>(data)->temperature;
const double green_val = static_cast<Data*>(data)->green_val;
delete static_cast<Data*>(data);
self->disableListener();
self->setEnabled(true);
self->temp->setValue(temperature);
self->green->setValue(green_val);
self->temp->setDefault(temperature);
self->green->setDefault(green_val);
self->enableListener();
return FALSE;
};
idle_register.add(func, new Data{this, temperature, greenVal});
}

View File

@@ -77,6 +77,9 @@ protected:
int custom_temp;
double custom_green;
double custom_equal;
IdleRegister idle_register;
void cache_customWB (int temp, double green); //cache custom WB setting to allow its recall
void cache_customTemp (int temp); //cache Temperature only to allow its recall
void cache_customGreen (double green); //cache Green only to allow its recall
@@ -92,7 +95,7 @@ protected:
public:
WhiteBalance ();
~WhiteBalance () {};
~WhiteBalance ();
static void init ();
static void cleanup ();