Re: 2.4 Crash (was: Updated LaTeXConfig.lyx (bxjsclasses added))

2023-02-06 Thread Pavel Sanda
On Mon, Feb 06, 2023 at 06:09:52PM +0100, Jean-Marc Lasgouttes wrote:
> Le 06/02/2023 ?? 16:46, Pavel Sanda a écrit :
> >On Mon, Feb 06, 2023 at 04:34:07PM +0100, Jean-Marc Lasgouttes wrote:
> >>Le 06/02/2023 ?? 15:50, Pavel Sanda a écrit :
> >>>Indeed:
> >>>insets/InsetInfo.cpp (1246): validate() -> build()
> >>>
> >>>lyx: SIGSEGV signal caught!
> >>
> >>What about this? I expect display glitches.
> >
> >I couldn't get crash with this patch.
> 
> Do you see other weird things?

Yes. When I load the file the insetinfo shows its information.
After fraction of second editor/toolbar somewhat blinks (that's normal,
I think its when previews are initially loaded/shown into the document
view). 
At this moment it used to crash. Now it does not, but the content
of insetinfo disappears. I need to move with the mouse over the window
to have the inset displayed again (no biggie compared to crash).

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


Re: 2.4 Crash (was: Updated LaTeXConfig.lyx (bxjsclasses added))

2023-02-06 Thread Jean-Marc Lasgouttes

Le 06/02/2023 à 16:34, Jean-Marc Lasgouttes a écrit :

Le 06/02/2023 à 15:50, Pavel Sanda a écrit :

Indeed:
insets/InsetInfo.cpp (1246): validate() -> build()

lyx: SIGSEGV signal caught!


What about this? I expect display glitches.


I pushed it to master.

JMarc

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


Re: 2.4 Crash (was: Updated LaTeXConfig.lyx (bxjsclasses added))

2023-02-06 Thread Jean-Marc Lasgouttes

Le 06/02/2023 à 16:46, Pavel Sanda a écrit :

On Mon, Feb 06, 2023 at 04:34:07PM +0100, Jean-Marc Lasgouttes wrote:

Le 06/02/2023 ?? 15:50, Pavel Sanda a écrit :

Indeed:
insets/InsetInfo.cpp (1246): validate() -> build()

lyx: SIGSEGV signal caught!


What about this? I expect display glitches.


I couldn't get crash with this patch.


Do you see other weird things?

JMarc

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


Re: 2.4 Crash (was: Updated LaTeXConfig.lyx (bxjsclasses added))

2023-02-06 Thread Pavel Sanda
On Mon, Feb 06, 2023 at 04:34:07PM +0100, Jean-Marc Lasgouttes wrote:
> Le 06/02/2023 ?? 15:50, Pavel Sanda a écrit :
> >Indeed:
> >insets/InsetInfo.cpp (1246): validate() -> build()
> >
> >lyx: SIGSEGV signal caught!
> 
> What about this? I expect display glitches.

I couldn't get crash with this patch.
Pavel
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: 2.4 Crash (was: Updated LaTeXConfig.lyx (bxjsclasses added))

2023-02-06 Thread Jean-Marc Lasgouttes

Le 06/02/2023 à 15:50, Pavel Sanda a écrit :

Indeed:
insets/InsetInfo.cpp (1246): validate() -> build()

lyx: SIGSEGV signal caught!


What about this? I expect display glitches.

JMarc
diff --git a/src/insets/InsetInfo.cpp b/src/insets/InsetInfo.cpp
index 46d656c817..f2d3b93ad8 100644
--- a/src/insets/InsetInfo.cpp
+++ b/src/insets/InsetInfo.cpp
@@ -467,7 +467,7 @@ string InsetInfoParams::infoType() const
 
 
 InsetInfo::InsetInfo(Buffer * buf, string const & info)
-	: InsetCollapsible(buf), initialized_(false)
+	: InsetCollapsible(buf), initialized_(false), dirty_(true)
 {
 	params_.type = InsetInfoParams::UNKNOWN_INFO;
 	params_.force_ltr = false;
@@ -779,15 +779,19 @@ void InsetInfo::metrics(MetricsInfo & mi, Dimension & dim) const
 {
 	const_cast(this)->build();
 	InsetCollapsible::metrics(mi, dim);
+	dirty_ = false;
 }
 
 
 void InsetInfo::draw(PainterInfo & pi, int x, int y) const
 {
+	if (dirty_)
+		return;
 	Changer chg = changeVar(lyxrc.mark_foreign_language, false);
 	InsetCollapsible::draw(pi, x, y);
 }
 
+
 void InsetInfo::updateBuffer(ParIterator const & it, UpdateType utype, bool const deleted)
 
 {
@@ -1235,6 +1239,8 @@ void InsetInfo::build()
 	}
 	}
 
+	// indicate that metrics are not usable anymore
+	dirty_ = true;
 	// Just to do something with that string
 	LYXERR(Debug::INFO, "info inset text: " << gui);
 }
diff --git a/src/insets/InsetInfo.h b/src/insets/InsetInfo.h
index 3531b41681..8e506ed9ed 100644
--- a/src/insets/InsetInfo.h
+++ b/src/insets/InsetInfo.h
@@ -237,6 +237,8 @@ private:
 	///
 	bool initialized_;
 	///
+	mutable bool dirty_;
+	///
 	InsetInfoParams params_;
 	///
 	friend class InsetInfoParams;
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: 2.4 Crash (was: Updated LaTeXConfig.lyx (bxjsclasses added))

2023-02-06 Thread Pavel Sanda
On Mon, Feb 06, 2023 at 03:19:15PM +0100, Jean-Marc Lasgouttes wrote:
> Le 06/02/2023 ?? 15:02, Jean-Marc Lasgouttes a écrit :
> >Le 06/02/2023 ?? 13:32, Pavel Sanda a écrit :
> >>>Unfortunately valgrind changes speed of painting and I can't reproduce
> >>>it then.
> >>>But I am able to run it with any lyxer debug ouput or check potential
> >>>patch
> >>>if you have some idea...
> >>
> >>JMarc, do you have idea for a potential patch? P
> >
> >You are wise to ping me, I forgot about this one.
> >
> >One solution would be high-level, like "forbid screen redraws while some
> >inset is the unstable state" (this is _expected_ to be a very transient
> >situation.
> >
> >Other solution would be very local and try to avoid these regenerations of
> >info insets (maybe just mark as dirty and regenerate on demand).
> 
> Could you try to apply this patch and tell me what debug message you obtain?
> I expect the last one will be validate->build.

Indeed:
insets/InsetInfo.cpp (1246): validate() -> build()
 (zilion times)
insets/InsetInfo.cpp (1246): validate() -> build()
insets/InsetInfo.cpp (1246): validate() -> build()
insets/InsetInfo.cpp (780): metrics() -> build()
insets/InsetInfo.cpp (780): metrics() -> build()
insets/InsetInfo.cpp (780): metrics() -> build()
insets/InsetInfo.cpp (780): metrics() -> build()
insets/InsetInfo.cpp (780): metrics() -> build()
insets/InsetInfo.cpp (780): metrics() -> build()
insets/InsetInfo.cpp (780): metrics() -> build()
insets/InsetInfo.cpp (780): metrics() -> build()
insets/InsetInfo.cpp (780): metrics() -> build()
insets/InsetInfo.cpp (780): metrics() -> build()
insets/InsetInfo.cpp (780): metrics() -> build()
insets/InsetInfo.cpp (780): metrics() -> build()
insets/InsetInfo.cpp (1246): validate() -> build()
 (zilion times)
insets/InsetInfo.cpp (1246): validate() -> build()

lyx: SIGSEGV signal caught!
...

> 
> Do you have the code pane open?

No.

> I wonder why validate is called. Maybe previews generation.

Yes I do have previews on. Also the crash needs my mouse cursor
moves above LyX window to trigger this (maybe the action triggered
by cursor gliding over inset info?)

I think I found another way how to trigger the crash:
1. move your cursor on the changes japanese related changes.
2. go to the gui prefs and check(or uncheck) end of paragraph
   markers in display pane, click Ok
3. kaboom

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


Re: 2.4 Crash (was: Updated LaTeXConfig.lyx (bxjsclasses added))

2023-02-06 Thread Jean-Marc Lasgouttes

Le 06/02/2023 à 15:02, Jean-Marc Lasgouttes a écrit :

Le 06/02/2023 à 13:32, Pavel Sanda a écrit :
Unfortunately valgrind changes speed of painting and I can't 
reproduce it then.
But I am able to run it with any lyxer debug ouput or check potential 
patch

if you have some idea...


JMarc, do you have idea for a potential patch? P


You are wise to ping me, I forgot about this one.

One solution would be high-level, like "forbid screen redraws while some 
inset is the unstable state" (this is _expected_ to be a very transient 
situation.


Other solution would be very local and try to avoid these regenerations 
of info insets (maybe just mark as dirty and regenerate on demand).


Could you try to apply this patch and tell me what debug message you 
obtain?

I expect the last one will be validate->build.

Do you have the code pane open? I wonder why validate is called. Maybe 
previews generation.


JMarc


diff --git a/src/insets/InsetInfo.cpp b/src/insets/InsetInfo.cpp
index 46d656c817..f88a3a1ef6 100644
--- a/src/insets/InsetInfo.cpp
+++ b/src/insets/InsetInfo.cpp
@@ -777,6 +777,7 @@ bool InsetInfo::forceLocalFontSwitch() const
 
 void InsetInfo::metrics(MetricsInfo & mi, Dimension & dim) const
 {
+	LYXERR0("metrics() -> build()");
 	const_cast(this)->build();
 	InsetCollapsible::metrics(mi, dim);
 }
@@ -1242,6 +1243,7 @@ void InsetInfo::build()
 
 void InsetInfo::validate(LaTeXFeatures & features) const
 {
+	LYXERR0("validate() -> build()");
 	const_cast(this)->build();
 	InsetCollapsible::validate(features);
 }
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: 2.4 Crash (was: Updated LaTeXConfig.lyx (bxjsclasses added))

2023-02-06 Thread Jean-Marc Lasgouttes

Le 06/02/2023 à 13:32, Pavel Sanda a écrit :

Unfortunately valgrind changes speed of painting and I can't reproduce it then.
But I am able to run it with any lyxer debug ouput or check potential patch
if you have some idea...


JMarc, do you have idea for a potential patch? P


You are wise to ping me, I forgot about this one.

One solution would be high-level, like "forbid screen redraws while some 
inset is the unstable state" (this is _expected_ to be a very transient 
situation.


Other solution would be very local and try to avoid these regenerations 
of info insets (maybe just mark as dirty and regenerate on demand).


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


Re: 2.4 Crash (was: Updated LaTeXConfig.lyx (bxjsclasses added))

2023-02-06 Thread Pavel Sanda
On Thu, Jan 26, 2023 at 11:45:58PM +0100, Pavel Sanda wrote:
> On Thu, Jan 26, 2023 at 03:08:13PM +0100, Jean-Marc Lasgouttes wrote:
> > Le 26/01/2023 ?? 02:05, Pavel Sanda a écrit :
> > >On Thu, Jan 26, 2023 at 01:23:55AM +0100, Pavel Sanda wrote:
> > >>I can reproduce it only when not running under gdb.
> > >
> > >It also seem impossible to reproduce when compiling with debug symbols.
> > >Without them reproducibility seems to depends on the exact trajectory I do
> > >with the mouse over the editing window (perhaps triggering some repaint
> > >event when going over Inset?)
> > 
> > What I see from the backtrace looks like:
> > 1/ metrics are computed for some info inset
> > 2/ the info inset is regenerated (and thus the paragraph it held is now
> > invalid)
> > 3/ We draw the inset and because of the new (disabled by default) bookmark
> > display code, we access the id() of the invalid paragraph.
> > 4/ boom
> > 
> > This scenario can probably be verified using valgrind.
> 
> Unfortunately valgrind changes speed of painting and I can't reproduce it 
> then.
> But I am able to run it with any lyxer debug ouput or check potential patch
> if you have some idea...

JMarc, do you have idea for a potential patch? P
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: Beta 2?

2023-02-06 Thread Pavel Sanda
On Sun, Feb 05, 2023 at 08:33:52PM +0100, Jean-Marc Lasgouttes wrote:
> The level of warnings is now much mower, but I still see some about the
> deprecation of std::unary_fonction and std::binary_function. We could either
> backport the 4 patches below or keep things as they are, since the functors
> are only removed in C++17 and autoconf uses either C++14 or C++11. We would
> have problems only if compilers start to accept only C++ >= 17.
> 
> Thoughts?

I don't see distros containing outdated lyx pushing for only C++ >= 17
compilers, co I'd probably leave it as is. 

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