Avoid deadlock by shifting GUI update to idle thread (#4224)
This commit is contained in:
@@ -253,6 +253,7 @@ void ToolPanelCoordinator::addPanel (Gtk::Box* where, FoldableToolPanel* panel,
|
|||||||
|
|
||||||
ToolPanelCoordinator::~ToolPanelCoordinator ()
|
ToolPanelCoordinator::~ToolPanelCoordinator ()
|
||||||
{
|
{
|
||||||
|
idle_register.destroy();
|
||||||
|
|
||||||
closeImage ();
|
closeImage ();
|
||||||
|
|
||||||
@@ -262,29 +263,58 @@ ToolPanelCoordinator::~ToolPanelCoordinator ()
|
|||||||
|
|
||||||
void ToolPanelCoordinator::imageTypeChanged (bool isRaw, bool isBayer, bool isXtrans)
|
void ToolPanelCoordinator::imageTypeChanged (bool isRaw, bool isBayer, bool isXtrans)
|
||||||
{
|
{
|
||||||
GThreadLock lock;
|
|
||||||
|
|
||||||
if (isRaw) {
|
if (isRaw) {
|
||||||
rawPanelSW->set_sensitive (true);
|
|
||||||
|
|
||||||
if (isBayer) {
|
if (isBayer) {
|
||||||
sensorxtrans->FoldableToolPanel::hide();
|
const auto func = [](gpointer data) -> gboolean {
|
||||||
sensorbayer->FoldableToolPanel::show();
|
ToolPanelCoordinator* const self = static_cast<ToolPanelCoordinator*>(data);
|
||||||
preprocess->FoldableToolPanel::show();
|
|
||||||
flatfield->FoldableToolPanel::show();
|
self->rawPanelSW->set_sensitive (true);
|
||||||
} else if (isXtrans) {
|
self->sensorxtrans->FoldableToolPanel::hide();
|
||||||
sensorxtrans->FoldableToolPanel::show();
|
self->sensorbayer->FoldableToolPanel::show();
|
||||||
sensorbayer->FoldableToolPanel::hide();
|
self->preprocess->FoldableToolPanel::show();
|
||||||
preprocess->FoldableToolPanel::show();
|
self->flatfield->FoldableToolPanel::show();
|
||||||
flatfield->FoldableToolPanel::show();
|
|
||||||
} else {
|
return FALSE;
|
||||||
sensorbayer->FoldableToolPanel::hide();
|
};
|
||||||
sensorxtrans->FoldableToolPanel::hide();
|
idle_register.add(func, this);
|
||||||
preprocess->FoldableToolPanel::hide();
|
}
|
||||||
flatfield->FoldableToolPanel::hide();
|
else if (isXtrans) {
|
||||||
|
const auto func = [](gpointer data) -> gboolean {
|
||||||
|
ToolPanelCoordinator* const self = static_cast<ToolPanelCoordinator*>(data);
|
||||||
|
|
||||||
|
self->rawPanelSW->set_sensitive (true);
|
||||||
|
self->sensorxtrans->FoldableToolPanel::show();
|
||||||
|
self->sensorbayer->FoldableToolPanel::hide();
|
||||||
|
self->preprocess->FoldableToolPanel::show();
|
||||||
|
self->flatfield->FoldableToolPanel::show();
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
};
|
||||||
|
idle_register.add(func, this);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
const auto func = [](gpointer data) -> gboolean {
|
||||||
|
ToolPanelCoordinator* const self = static_cast<ToolPanelCoordinator*>(data);
|
||||||
|
|
||||||
|
self->rawPanelSW->set_sensitive (true);
|
||||||
|
self->sensorbayer->FoldableToolPanel::hide();
|
||||||
|
self->sensorxtrans->FoldableToolPanel::hide();
|
||||||
|
self->preprocess->FoldableToolPanel::hide();
|
||||||
|
self->flatfield->FoldableToolPanel::hide();
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
};
|
||||||
|
idle_register.add(func, this);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
rawPanelSW->set_sensitive (false);
|
const auto func = [](gpointer data) -> gboolean {
|
||||||
|
ToolPanelCoordinator* const self = static_cast<ToolPanelCoordinator*>(data);
|
||||||
|
|
||||||
|
self->rawPanelSW->set_sensitive (false);
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
};
|
||||||
|
idle_register.add(func, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -301,6 +301,9 @@ public:
|
|||||||
void editModeSwitchedOff ();
|
void editModeSwitchedOff ();
|
||||||
|
|
||||||
void setEditProvider (EditDataProvider *provider);
|
void setEditProvider (EditDataProvider *provider);
|
||||||
|
|
||||||
|
private:
|
||||||
|
IdleRegister idle_register;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user