Re: Crash on master because of cursor position in session

2022-01-22 Thread Jean-Marc Lasgouttes

Le 22/01/2022 à 21:43, Pavel Sanda a écrit :

Error: Software exception Detected

LyX has caught an exception, it will now attempt to save all unsaved documents 
and exit.

Exception: basic_string::substr: __pos (which is 32) > this->size() (which is 
31)


I do not know enough about row structure to inspect what's wrong with the 
variables.


Thanks for looking. I will have a go at it.

JMarc

--
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: Crash on master because of cursor position in session

2022-01-22 Thread Pavel Sanda
On Sat, Jan 22, 2022 at 09:43:15PM +0100, Pavel Sanda wrote:
> lyx::TextMetrics::redoParagraph:522 pm.rows() = breakParagraph(bigrow); -> 
> step into
> lyx::TextMetrics::breakParagraph:1136 tail = rb.shortenIfNeeded(width, 
> next_width); -> step into
> lyx::Row::shortenIfNeeded:640 if (cit->splitAt(w - wid, next_width, true, 
> tail)) {
> 
> ... (equivalently 4x cont on  Row.cpp:640 breakpoint and then step in)
> 
> Thread 1 "lyx" hit Breakpoint 5, lyx::Row::shortenIfNeeded 
> (this=0x588a7ae0, w=569, next_width=203) at Row.cpp:640
> 640 if (cit->splitAt(w - wid, next_width, true, tail)) {


Biset leads to:
commit d723b90344c0e56b26fc69aa00cb3001e074a723
Author: Jean-Marc Lasgouttes 
Date:   Mon Sep 6 14:52:42 2021 +0200

Break multi-row strings in one pass

Replace FontMetrics::breakAt, which returned the next break point,
with FontMetrics::breakString, which returns a vector of break points.
To this end, an additional parameter gives the available width for
next rows.

Rename various variables and methods accordingly. Factor the code in
breakString_helper to be more manageable.

Adapt Row::Element::splitAt to return a bool on sucess and provide
remaining row elements in a vector. The width noted above has been
added as parameters.

Rename the helper function splitFrom to moveElements and rewrite the
code to be more efficient.

Remove type of row element INVALID, which is not needed anymore.

The code in TextMetrics::breakParagraph is now much simpler.

In Row::finalize, remove the code that computed inconditionnally the
current element size, and make sure that this width will be computed
in all code paths of Row::Element::splitAt.

Pavel
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: [LyX/master] Add new placeholder $${python} to configure

2022-01-22 Thread José Abílio Matos
On Saturday, 22 January 2022 19.49.26 WET Pavel Sanda wrote:
> Hi Jose,
> 
> this what I see in curent master:
> 1. start lyx
> 2. load file
> 3. this is  what I see in terminal window:
> env: '$${python}': No such file or directory
> 
> Most likely related to image preview conversions, this what I see with debug
> messages on graphics:
> graphics/PreviewLoader.cpp (757): PreviewLoader::finishedInProgress(127):
> processing failed for $${python} $$s/scripts/lyxpreview2bitmap.py --png
> "/tmp/lyx_tmpdir.LiGxsfYQmUxW/lyx_tmpbuf6/lyxpreviewGdodeo.tex" --dpi 115
> --fg ff9822 --bg 00 --bibtex="bibtex"
> 
> 
> These binaries available on my system:
> python python2python2.7  python3python3.9
> python defaults to python2.7
> 
> Pavel

The problem here is that the placeholder is not replaced before being used.
In order to see what python is being used you can see:

Help->About LyX


In a hunch does the attached patch fixes the issue?
The idea is to replace the placeholder when the converter is added/imported.

-- 
José Abíliodiff --git a/src/Converter.cpp b/src/Converter.cpp
index c00941d21f..7bb998d5a9 100644
--- a/src/Converter.cpp
+++ b/src/Converter.cpp
@@ -148,6 +148,12 @@ void Converter::readFlags()
 }
 
 
+void Converter::setCommand(std::string const & command)
+{
+	command_ = subst(command, token_python, os::python());
+}
+
+
 Converter const * Converters::getConverter(string const & from,
 	string const & to) const
 {
diff --git a/src/Converter.h b/src/Converter.h
index 5197e3447a..091dbcd394 100644
--- a/src/Converter.h
+++ b/src/Converter.h
@@ -58,7 +58,7 @@ public:
 	///
 	std::string const command() const { return command_; }
 	///
-	void setCommand(std::string const & command) { command_ = command; }
+	void setCommand(std::string const & command);
 	///
 	std::string const flags() const { return flags_; }
 	///
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: Crash on master because of cursor position in session

2022-01-22 Thread Pavel Sanda
On Sun, Jan 16, 2022 at 12:02:50PM +0100, Kornel Benko wrote:
> Moreover, from then on the crash will always happen.
> Resetting the line in lyx2.4.conf from
>   zoom_ratio=1.9333
> to
>   zoom_ratio=1.0
> cured it.
> 
> Running under gdb, the software exception happens deep inside QT.
> (Not enough skills to find a workaround, sorry)

If you go step by step in gdb you'll see that last steps before the exceptions 
are:

lyx::TextMetrics::redoParagraph:522 pm.rows() = breakParagraph(bigrow); -> step 
into
lyx::TextMetrics::breakParagraph:1136 tail = rb.shortenIfNeeded(width, 
next_width); -> step into
lyx::Row::shortenIfNeeded:640 if (cit->splitAt(w - wid, next_width, true, 
tail)) {

... (equivalently 4x cont on  Row.cpp:640 breakpoint and then step in)

Thread 1 "lyx" hit Breakpoint 5, lyx::Row::shortenIfNeeded 
(this=0x588a7ae0, w=569, next_width=203) at Row.cpp:640
640 if (cit->splitAt(w - wid, next_width, true, tail)) {
(gdb) s
__gnu_debug::_Safe_iterator<__gnu_cxx::__normal_iterator > 
>, std::__debug::vector >, 
std::forward_iterator_tag>::operator-> (
this=0x7fffa840) at /usr/include/c++/10/debug/safe_iterator.h:314
314 _GLIBCXX_DEBUG_VERIFY(this->_M_dereferenceable(),
(gdb) n
317 return base().operator->();
(gdb) n
318   }
(gdb) 
Error: Software exception Detected

LyX has caught an exception, it will now attempt to save all unsaved documents 
and exit.

Exception: basic_string::substr: __pos (which is 32) > this->size() (which is 
31)


I do not know enough about row structure to inspect what's wrong with the 
variables.

Pavel
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: [LyX/master] Add new placeholder $${python} to configure

2022-01-22 Thread Pavel Sanda
On Tue, Jan 04, 2022 at 12:52:37AM +0100, JosĂŠ Matos wrote:
> commit 109ea2be4a21ca93d22ab25703b3352a50fbbe3b
> Author: José Matos 
> Date:   Tue Jan 4 00:21:34 2022 +
> 
> Add new placeholder $${python} to configure
> 
> This ensures that we use a consistent Python interpreter in LyX.
> 
> $${python} is replaced by the Python version found.
> 
> Users can apply this in preferences and use the same version defined by
> LyX.

Hi Jose,

this what I see in curent master:
1. start lyx 
2. load file
3. this is  what I see in terminal window:
env: '$${python}': No such file or directory

Most likely related to image preview conversions, this what I see with debug
messages on graphics:
graphics/PreviewLoader.cpp (757): PreviewLoader::finishedInProgress(127): 
processing failed for $${python} $$s/scripts/lyxpreview2bitmap.py --png 
"/tmp/lyx_tmpdir.LiGxsfYQmUxW/lyx_tmpbuf6/lyxpreviewGdodeo.tex" --dpi 115 --fg 
ff9822 --bg 00 --bibtex="bibtex"


These binaries available on my system:
python python2python2.7  python3python3.9
python defaults to python2.7

Pavel
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: runtime error: load of value 4294967293, which is not a valid value for type 'const lyx::Update::flags'

2022-01-22 Thread Kornel Benko
Am Sat, 22 Jan 2022 18:35:12 +0100
schrieb Kornel Benko :

> Am Sat, 22 Jan 2022 10:04:44 -0500
> schrieb Scott Kostyshak :
> 
> > With Clang and fsanitize, I get the following error when I open a buffer:
> > 
> >   runtime error: load of value 4294967293, which is not a valid value for 
> > type 'const
> > lyx::Update::flags'
> > 
> > Attached is the backtrace (which is printed to terminal if I set 'export
> > UBSAN_OPTIONS=print_stacktrace=1').
> > 
> > Scott  
> 
> I see the same here. (No crash, but the messages on terminal)
> 
>   Kornel

If I understand it correctly, the routine
inline flags operator&(flags const f, flags const g)
gets the value f as:
(update_flags & ~Update::Force)
Since 32-bit-value 4294967293 is the same as '~Update::Force', which is too big 
for
32-bit integer, we possibly have the same 'problem' as with colors.

BTW Update::Force is defined as '2' and the hex value of 4294967293 is FFFD.

Kornel


pgpG1JMLWDLW_.pgp
Description: Digitale Signatur von OpenPGP
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: runtime error: load of value 4294967293, which is not a valid value for type 'const lyx::Update::flags'

2022-01-22 Thread Kornel Benko
Am Sat, 22 Jan 2022 10:04:44 -0500
schrieb Scott Kostyshak :

> With Clang and fsanitize, I get the following error when I open a buffer:
> 
>   runtime error: load of value 4294967293, which is not a valid value for 
> type 'const
> lyx::Update::flags'
> 
> Attached is the backtrace (which is printed to terminal if I set 'export
> UBSAN_OPTIONS=print_stacktrace=1').
> 
> Scott

I see the same here. (No crash, but the messages on terminal)

Kornel


pgpSya50WfleR.pgp
Description: Digitale Signatur von OpenPGP
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


runtime error: load of value 4294967293, which is not a valid value for type 'const lyx::Update::flags'

2022-01-22 Thread Scott Kostyshak
With Clang and fsanitize, I get the following error when I open a buffer:

  runtime error: load of value 4294967293, which is not a valid value for type 
'const lyx::Update::flags'

Attached is the backtrace (which is printed to terminal if I set 'export 
UBSAN_OPTIONS=print_stacktrace=1').

Scott
/home/scott/lyxbuilds/master/repo/src/update_flags.h:44:41: runtime error: load 
of value 4294967293, which is not a valid value for type 'const 
lyx::Update::flags'
#0 0xfe5bbf in lyx::Update::operator&(lyx::Update::flags, 
lyx::Update::flags) /home/scott/lyxbuilds/master/repo/src/update_flags.h:44:41
#1 0xfa9072 in lyx::BufferView::updateMetrics(lyx::Update::flags&) 
/home/scott/lyxbuilds/master/repo/src/BufferView.cpp:3025:31
#2 0xfac3ac in lyx::BufferView::updateMetrics() 
/home/scott/lyxbuilds/master/repo/src/BufferView.cpp:2933:2
#3 0xfd44b5 in lyx::BufferView::resize(int, int) 
/home/scott/lyxbuilds/master/repo/src/BufferView.cpp:2346:2
#4 0x21f5b16 in lyx::frontend::GuiWorkArea::init() 
/home/scott/lyxbuilds/master/repo/src/frontends/qt/GuiWorkArea.cpp:206:19
#5 0x21f4982 in lyx::frontend::GuiWorkArea::GuiWorkArea(lyx::Buffer&, 
lyx::frontend::GuiView&) 
/home/scott/lyxbuilds/master/repo/src/frontends/qt/GuiWorkArea.cpp:178:2
#6 0x221fcc4 in lyx::frontend::TabWorkArea::addWorkArea(lyx::Buffer&, 
lyx::frontend::GuiView&) 
/home/scott/lyxbuilds/master/repo/src/frontends/qt/GuiWorkArea.cpp:1743:25
#7 0x2180694 in lyx::frontend::GuiView::addWorkArea(lyx::Buffer&) 
/home/scott/lyxbuilds/master/repo/src/frontends/qt/GuiView.cpp:1732:21
#8 0x2184688 in lyx::frontend::GuiView::setBuffer(lyx::Buffer*, bool) 
/home/scott/lyxbuilds/master/repo/src/frontends/qt/GuiView.cpp:1937:8
#9 0x2199543 in 
lyx::frontend::GuiView::newDocument(std::__cxx11::basic_string, std::allocator > const&, 
std::__cxx11::basic_string, std::allocator 
>, bool) /home/scott/lyxbuilds/master/repo/src/frontends/qt/GuiView.cpp:2909:3
#10 0x206dea5 in lyx::frontend::GuiApplication::dispatch(lyx::FuncRequest 
const&, lyx::DispatchResult&) 
/home/scott/lyxbuilds/master/repo/src/frontends/qt/GuiApplication.cpp:1813:19
#11 0x2065f79 in lyx::frontend::GuiApplication::dispatch(lyx::FuncRequest 
const&) 
/home/scott/lyxbuilds/master/repo/src/frontends/qt/GuiApplication.cpp:1561:3
#12 0x13797e9 in lyx::dispatch(lyx::FuncRequest const&) 
/home/scott/lyxbuilds/master/repo/src/LyX.cpp:1482:19
#13 0x207beb0 in 
lyx::frontend::GuiApplication::processFuncRequest(lyx::FuncRequest const&) 
/home/scott/lyxbuilds/master/repo/src/frontends/qt/GuiApplication.cpp:2510:2
#14 0x2081f66 in 
lyx::frontend::GuiApplication::processKeySym(lyx::KeySymbol const&, unsigned 
int) 
/home/scott/lyxbuilds/master/repo/src/frontends/qt/GuiApplication.cpp:2504:3
#15 0x21c196d in lyx::frontend::(anonymous 
namespace)::BackgroundWidget::keyPressEvent(QKeyEvent*) 
/home/scott/lyxbuilds/master/repo/src/frontends/qt/GuiView.cpp:250:12
#16 0x7f548b64f007 in QWidget::event(QEvent*) 
(/lib/x86_64-linux-gnu/libQt5Widgets.so.5+0x1b0007)
#17 0x7f548b60b6b2 in QApplicationPrivate::notify_helper(QObject*, QEvent*) 
(/lib/x86_64-linux-gnu/libQt5Widgets.so.5+0x16c6b2)
#18 0x7f548b61341d in QApplication::notify(QObject*, QEvent*) 
(/lib/x86_64-linux-gnu/libQt5Widgets.so.5+0x17441d)
#19 0x208caaa in lyx::frontend::GuiApplication::notify(QObject*, QEvent*) 
/home/scott/lyxbuilds/master/repo/src/frontends/qt/GuiApplication.cpp:3000:24
#20 0x7f548ab1d169 in QCoreApplication::notifyInternal2(QObject*, QEvent*) 
src/corelib/kernel/qcoreapplication.cpp:1063:24
#21 0x7f548b66ac9e  (/lib/x86_64-linux-gnu/libQt5Widgets.so.5+0x1cbc9e)
#22 0x7f548b60b6b2 in QApplicationPrivate::notify_helper(QObject*, QEvent*) 
(/lib/x86_64-linux-gnu/libQt5Widgets.so.5+0x16c6b2)
#23 0x208caaa in lyx::frontend::GuiApplication::notify(QObject*, QEvent*) 
/home/scott/lyxbuilds/master/repo/src/frontends/qt/GuiApplication.cpp:3000:24
#24 0x7f548ab1d169 in QCoreApplication::notifyInternal2(QObject*, QEvent*) 
src/corelib/kernel/qcoreapplication.cpp:1063:24
#25 0x7f548af00409 in 
QGuiApplicationPrivate::processKeyEvent(QWindowSystemInterfacePrivate::KeyEvent*)
 (/lib/x86_64-linux-gnu/libQt5Gui.so.5+0x13d409)
#26 0x7f548aed99bb in 
QWindowSystemInterface::sendWindowSystemEvents(QFlags)
 (/lib/x86_64-linux-gnu/libQt5Gui.so.5+0x1169bb)
#27 0x7f5486ca0b9d  (/lib/x86_64-linux-gnu/libQt5XcbQpa.so.5+0x73b9d)
#28 0x7f548a20d8ba in g_main_context_dispatch 
(/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x558ba)
#29 0x7f548a260f07  (/lib/x86_64-linux-gnu/libglib-2.0.so.0+0xa8f07)
#30 0x7f548a20b002 in g_main_context_iteration 
(/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x53002)
#31 0x7f548ab76547 in 
QEventDispatcherGlib::processEvents(QFlags) 
src/corelib/kernel/qeventdispatcher_glib.cpp:423:43
#32 0x7f548ab1ba9a in 
QEventLoop::exec(QFlags) 
src/corelib/kernel/qeventloop.cpp:232:22
#33 0x7f548ab24023 in