New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Automatically disable Auto-Fill when enabling LCP Disortion Correction, #1791 #3318
Conversation
fillConn.block (true); | ||
fill->set_active(false); | ||
if (listener) { | ||
listener->panelChanged (EvTransAutoFill, M("GENERAL_DISABLED")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line causes the release build to hang when opening a file, and the debug build prints:
MyMutex already locked!
If I comment out this line, no problem. But we need feedback via history so the user knows what's happening.
@Floessie Do you have an idea to solve this issue? |
@heckflosse @Beep6581 Okay, I had a quick look and know what's happening, although I have no instant idea how to solve this. First a patch to backtrace in the apllication itself (though diff --git a/rtengine/improccoordinator.cc b/rtengine/improccoordinator.cc
index 7434776..779a4da 100644
--- a/rtengine/improccoordinator.cc
+++ b/rtengine/improccoordinator.cc
@@ -1339,6 +1339,7 @@ void ImProcCoordinator::process ()
ProcParams* ImProcCoordinator::beginUpdateParams ()
{
+ backtrace();
paramsUpdateMutex.lock ();
return &nextParams;
diff --git a/rtengine/utils.cc b/rtengine/utils.cc
index 2366f3a..59bbdd2 100644
--- a/rtengine/utils.cc
+++ b/rtengine/utils.cc
@@ -16,15 +16,38 @@
* You should have received a copy of the GNU General Public License
* along with RawTherapee. If not, see <http://www.gnu.org/licenses/>.
*/
+#include <string>
#include <cmath>
#include <cstring>
#include <cstdio>
-#include "rt_math.h"
+
+#include <execinfo.h>
+#include <cxxabi.h>
#include "utils.h"
#include "rt_math.h"
-using namespace std;
+namespace
+{
+
+std::string demangleTypename(const char* mangled_typename)
+{
+ std::string res;
+
+ int status = 0;
+ char* const demangled_typename = abi::__cxa_demangle(mangled_typename, nullptr, nullptr, &status);
+ if (!status) {
+ res = demangled_typename;
+ free(demangled_typename);
+ } else {
+ res = mangled_typename;
+ }
+
+ return res;
+}
+
+}
namespace rtengine
{
@@ -228,6 +251,30 @@ void vflip (unsigned char* img, int w, int h)
delete [] flipped;
}
+void backtrace()
+{
+ void* items[100];
+ const size_t items_received = ::backtrace(items, 100);
+
+ char** strings = backtrace_symbols(items, items_received);
+ std::fprintf(stderr, "Obtained %zu stack frames:\n", items_received);
+
+ for (size_t i = 0; i < items_received; ++i) {
+ std::string str = strings[i];
+
+ std::string::size_type start_pos = str.find("(_Z");
+ const std::string::size_type end_pos = str.find("+0x", start_pos);
+ if (start_pos != std::string::npos && end_pos != std::string::npos) {
+ ++start_pos;
+ str = str.substr(0, start_pos) + demangleTypename(str.substr(start_pos, end_pos - start_pos).c_str()) + str.substr(end_pos);
+ }
+
+ std::fprintf(stderr, " %02zu: %s\n", i, str.c_str());
+ }
+
+ std::free(strings);
+}
+
}
diff --git a/rtengine/utils.h b/rtengine/utils.h
index 1e742ff..e7568f3 100644
--- a/rtengine/utils.h
+++ b/rtengine/utils.h
@@ -35,5 +35,7 @@ void rotate (unsigned char* img, int& w, int& h, int deg);
void hflip (unsigned char* img, int w, int h);
void vflip (unsigned char* img, int w, int h);
+void backtrace();
+
}
#endif Now the discovery:
Analysis: Solution: Make HTH, |
I sometimes try to make patches, for the fun of it, but I am not a C++ developer, and you have infinitely more insight into this than I do. I hope to get to that level at some time in the future, but in the last few months I had to learn VB6 and I generally still have to learn Swedish, so learning C++ must be put on hold. The patch works fine if I remove the |
@Beep6581 I'll have a look. |
@Beep6581 I think, I found a solution, though I'm no GUI expert. :) The idea is to shift the work to the main loop, as GTK is not thread-safe (which I grievously realized after employing Here is the patch: diff --git a/rtgui/lensgeom.cc b/rtgui/lensgeom.cc
index d50a16f..1d39ced 100644
--- a/rtgui/lensgeom.cc
+++ b/rtgui/lensgeom.cc
@@ -43,6 +43,11 @@ LensGeometry::LensGeometry () : FoldableToolPanel(this, "lensgeom", M("TP_LENSGE
show_all ();
}
+LensGeometry::~LensGeometry ()
+{
+ g_idle_remove_by_data(this);
+}
+
void LensGeometry::read (const ProcParams* pp, const ParamsEdited* pedited)
{
@@ -116,16 +121,23 @@ void LensGeometry::setBatchMode (bool batchMode)
void LensGeometry::disableAutoFillIfActive ()
{
+ g_idle_add(doDisableAutoFillIfActive, this);
+}
- if (!batchMode) {
- if (fill->get_active()) {
- fillConn.block (true);
- fill->set_active(false);
- if (listener) {
- listener->panelChanged (EvTransAutoFill, M("GENERAL_DISABLED"));
+int LensGeometry::doDisableAutoFillIfActive (void* data)
+{
+ GThreadLock lock; // Is this really needed?
+
+ LensGeometry* const instance = static_cast<LensGeometry*>(data);
+
+ if (!instance->batchMode) {
+ if (instance->fill->get_active()) {
+ instance->fillConn.block (true);
+ instance->fill->set_active(false);
+ if (instance->listener) {
+ instance->listener->panelChanged (EvTransAutoFill, M("GENERAL_DISABLED"));
}
- fillConn.block (false);
+ instance->fillConn.block (false);
}
}
-
}
diff --git a/rtgui/lensgeom.h b/rtgui/lensgeom.h
index fe21feb..51a6e10 100644
--- a/rtgui/lensgeom.h
+++ b/rtgui/lensgeom.h
@@ -32,11 +32,12 @@ protected:
Gtk::CheckButton* fill;
bool lastFill;
sigc::connection fillConn;
- ToolParamBlock* packBox;
+ ToolParamBlock* packBox;
public:
LensGeometry ();
+ ~LensGeometry ();
Gtk::Box* getPackBox ()
{
@@ -54,6 +55,10 @@ public:
rlistener = l;
}
void disableAutoFillIfActive ();
+
+private:
+ static int doDisableAutoFillIfActive (void* data);
+
};
#endif HTH, |
@Floessie I tested it and it works great! Thank you. 👍 for merge. |
Utmärkt! |
@Floessie you can merge, you now have access. Welcome on board :) |
That's an honor. Thanks! |
👍 |
#1791