Le 27/05/2017 à 00:56, Guillaume MM a écrit :


Thread 1 "lyx" received signal SIGSEGV, Segmentation fault.
0x00007ffff68612ef in QFileInfo::absoluteFilePath() const ()
    from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5

#0  0x00007ffff68612ef in QFileInfo::absoluteFilePath() const ()
    from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#1  0x0000000000d3a681 in lyx::support::FileName::removeFile (
     this=this@entry=0x2fd0d68) at ../../../src/support/FileName.cpp:612
#2  0x0000000000cfbcbe in lyx::graphics::Converter::Impl::converted (
this=0x2fd0d10, retval=0) at ../../src/graphics/GraphicsConverter.cpp:205 #3 0x0000000000cfc28f in std::_Mem_fn_base<void (lyx::graphics::Converter::Impl::*)(int, int), true>::operator()<int, int, void>(lyx::graphics::Converter::Impl*, int&&, int&&) const (__object=<optimized out>, this=<optimized out>)
     at /usr/include/c++/5/functional:600


This is boost::signals2 calling a member function of a destroyed object.

Starting at 61b2bd5e, boost::bind was progressively replaced with
std::bind. They are not interchangeable though. boost::bind implements
the tracking of boost::signals{,2}::trackable objects. Now that
std::bind has completely replaced boost::bind, tracking never occurs.
With the attached patch it does not crash. (Only meant as a demo.)

The issue is sensitive to timing which is why the new FileMonitor
exacerbated the issue and why people who have tried to debug might have
noticed that it is harder to trigger with valgrind. But it is possible
that the issue has already occurred with other forms.

Fixing is easy but I prefer to review the complete code tree for the
problem.

Guillaume
diff --git a/src/support/bind.h b/src/support/bind.h
index 5a734ff..60f1304 100644
--- a/src/support/bind.h
+++ b/src/support/bind.h
@@ -13,13 +13,14 @@
 #define LYX_BIND_H
 
 #include "support/functional.h"
+#include "boost/bind.hpp"
 
 namespace lyx
 {
-	using std::placeholders::_1;
-	using std::placeholders::_2;
-	using std::bind;
-	using std::ref;
+	using boost::placeholders::_1;
+	using boost::placeholders::_2;
+	using boost::bind;
+	using boost::ref;
 }
 
 

Reply via email to