Re: Memory leak in master?

2017-02-23 Thread Jean-Marc Lasgouttes

Le 23/02/2017 à 18:05, Richard Heck a écrit :


Here is for reference the updated patch (even with comment
clarification). Richard?


OK. I'll test it over the next couple weeks, and if all is well move
toward 2.2.3.

rh

Done at 998c3e7c8ef. There is no status.22x entry, since this is a fix 
over a new feature.


JMarc


Re: [LyX/master] Use \providecommand for logical markup macros

2017-02-23 Thread Richard Heck
On 02/23/2017 05:12 AM, Jürgen Spitzmüller wrote:
> Am Freitag, den 17.02.2017, 08:37 +0100 schrieb Juergen Spitzmueller:
>> commit 1db9b50407d109d0516b047ba174b74c49486df1
>> Author: Juergen Spitzmueller 
>> Date:   Fri Feb 17 08:35:41 2017 +0100
>>
>> Use \providecommand for logical markup macros
>> 
>> \strong is already defined by recent fontspec.
>> 
>> Also use non-long definition (starred version), since the insets
>> only contain one paragraph.
> This should also go to stable.

OK.

rh



Re: [LyX/master] Compatibility fix for acmsiggraph.cls v0.93

2017-02-23 Thread Richard Heck
On 02/23/2017 05:10 AM, Jürgen Spitzmüller wrote:
> Am Sonntag, den 19.02.2017, 12:28 +0100 schrieb Juergen Spitzmueller:
>> commit a1d7b58e6e20dc50e2ea4fc7be6aa0dc3e415d27
>> Author: Juergen Spitzmueller 
>> Date:   Sun Feb 19 12:25:23 2017 +0100
>>
>> Compatibility fix for acmsiggraph.cls v0.93
>> 
>> Reported by Jean-Pierre Chrétien, fix suggested by Günter Milde.
>> 
>> Also add a note about obsolescence of the class, by Jean-Pierre.
> This should also go to stable.

OK.

rh



Re: Memory leak in master?

2017-02-23 Thread Richard Heck
On 02/23/2017 04:46 AM, Jean-Marc Lasgouttes wrote:
> Le 22/02/2017 à 18:03, Jean-Marc Lasgouttes a écrit :
>> Indeed. Richard, I think this patch should go in 2.2.3, because the
>> caching code that is in stable causes bad memory leaks with Qt5.
>
> Here is for reference the updated patch (even with comment
> clarification). Richard?

OK. I'll test it over the next couple weeks, and if all is well move
toward 2.2.3.

rh



Re: Memory leak in master?

2017-02-23 Thread Richard Heck
On 02/23/2017 04:46 AM, Jean-Marc Lasgouttes wrote:
> Le 22/02/2017 à 18:03, Jean-Marc Lasgouttes a écrit :
>> Indeed. Richard, I think this patch should go in 2.2.3, because the
>> caching code that is in stable causes bad memory leaks with Qt5.
>
> Here is for reference the updated patch (even with comment
> clarification). Richard?

OK. I'll test it over the next couple weeks.

rh



Crash in File-Open

2017-02-23 Thread Kornel Benko
OS: Linux =~ ubuntu 14.04, 64bit

I gave a try to QT5.8. But now I am getting crashes any time I try to open a 
file with File->Open.
This does not happen with 'open recent' or if lyx is called with a file 
parameter.

The backtrace shows that the crash in call to dmg.exec() 
src/frontends/qt4/FileDialog.cpp:161

The enclosing routine, FileDialog::open(path, filters suggested)
path = toqstr(".")
filters = filter(qt_("LyX Documents (*.lyx)")
so nothing special.

If I try to use lyx compiled with QT5.7, so the crash is there too as long as 
QT5.8 is selected by ldconfig.
If I try to use lyx compiled with QT5.8 ans select QT5.7 with ldconfig, lyx 
does not start because
`Qt_5.8' is not found.

Someone interested in backtrace?

I try to compile with automake ...
Compilation went smoothly.
But I have the same effect. So at least it does not depend on build-system.

Kornel



signature.asc
Description: This is a digitally signed message part.


Re: [LyX/master] Use \providecommand for logical markup macros

2017-02-23 Thread Jürgen Spitzmüller
Am Freitag, den 17.02.2017, 08:37 +0100 schrieb Juergen Spitzmueller:
> commit 1db9b50407d109d0516b047ba174b74c49486df1
> Author: Juergen Spitzmueller 
> Date:   Fri Feb 17 08:35:41 2017 +0100
> 
> Use \providecommand for logical markup macros
> 
> \strong is already defined by recent fontspec.
> 
> Also use non-long definition (starred version), since the insets
> only contain one paragraph.

This should also go to stable.

Jürgen

signature.asc
Description: This is a digitally signed message part


Re: [LyX/master] Compatibility fix for acmsiggraph.cls v0.93

2017-02-23 Thread Jürgen Spitzmüller
Am Sonntag, den 19.02.2017, 12:28 +0100 schrieb Juergen Spitzmueller:
> commit a1d7b58e6e20dc50e2ea4fc7be6aa0dc3e415d27
> Author: Juergen Spitzmueller 
> Date:   Sun Feb 19 12:25:23 2017 +0100
> 
> Compatibility fix for acmsiggraph.cls v0.93
> 
> Reported by Jean-Pierre Chrétien, fix suggested by Günter Milde.
> 
> Also add a note about obsolescence of the class, by Jean-Pierre.

This should also go to stable.

Jürgen

signature.asc
Description: This is a digitally signed message part


Re: [LyX/master] ctests: update inversion patterns.

2017-02-23 Thread Kornel Benko
Am Donnerstag, 23. Februar 2017 um 10:16:59, schrieb Jürgen Spitzmüller 

> Am Dienstag, den 21.02.2017, 12:01 +0100 schrieb Kornel Benko:
> > But now fails also (which previously passed)
> > 301 - export/export/latex/arabic_simple_pdf4_systemF (Failed)
> > Missing character: There is no ∗ in font
> > Scheherazade/OT:script=arab;language=DFLT;mapping=tex-text;!
> > 1771 - export/doc/ar/Intro_pdf4_systemF (Failed)
> > Missing character: There is no ∗ in font
> > Scheherazade/OT:script=arab;language=DFLT;mapping=tex-text;!
> 
> This one seems fixed with recent TL.

Confirmed.

> But there is another error with arabic and LuaTeX (don't if it it has
> been there before).

Yes, it was already included in invertedTests:104

> Jürgen

Kornel


signature.asc
Description: This is a digitally signed message part.


Re: Memory leak in master?

2017-02-23 Thread Jean-Marc Lasgouttes

Le 22/02/2017 à 18:03, Jean-Marc Lasgouttes a écrit :

Indeed. Richard, I think this patch should go in 2.2.3, because the
caching code that is in stable causes bad memory leaks with Qt5.


Here is for reference the updated patch (even with comment 
clarification). Richard?


JMarc


From 8e04248b2fea58a7edcf16fb3318c302b04c66e8 Mon Sep 17 00:00:00 2001
From: Guillaume Munch 
Date: Mon, 20 Feb 2017 23:59:24 +0100
Subject: [PATCH] Introduce support/Cache.h

Useful to cache copies of objects, including shared_ptrs. No risks of dangling
pointer, and avoid naked pointers in the source.

Fix memory leak when compiling with Qt5.

As part as the backport to stable, this code has been change to work
with C++98.

(cherry picked from commit 33b696c8acf2e64b44d449180781de6dbc203709)
(cherry picked from commit e04079aa528ecbf4a8e39ed2b19c3cb50174e151)
(cherry picked from commit 5211ca52cac2ad7a6669d15c39f2cee172d18323)
(cherry picked from commit 8353a53cc38fe364bee516e86a08251e4ae974fc)
---
 src/frontends/qt4/GuiFontMetrics.cpp |  126 +++---
 src/frontends/qt4/GuiFontMetrics.h   |   46 +++--
 src/frontends/qt4/GuiPainter.cpp |3 +-
 src/support/Cache.h  |   89 
 src/support/Makefile.am  |1 +
 5 files changed, 160 insertions(+), 105 deletions(-)
 create mode 100644 src/support/Cache.h

diff --git a/src/frontends/qt4/GuiFontMetrics.cpp b/src/frontends/qt4/GuiFontMetrics.cpp
index 5bb99aa..80ff819 100644
--- a/src/frontends/qt4/GuiFontMetrics.cpp
+++ b/src/frontends/qt4/GuiFontMetrics.cpp
@@ -24,14 +24,11 @@
 #include "support/convert.h"
 #include "support/lassert.h"
 
-#ifdef CACHE_SOME_METRICS
 #include 
-#endif
 
 using namespace std;
 using namespace lyx::support;
 
-#ifdef CACHE_SOME_METRICS
 namespace std {
 
 /*
@@ -46,11 +43,28 @@ uint qHash(lyx::docstring const & s)
 }
 
 }
-#endif
 
 namespace lyx {
 namespace frontend {
 
+
+/*
+ * Limit (strwidth|breakat)_cache_ size to 512kB of string data.
+ * Limit qtextlayout_cache_ size to 500 elements (we do not know the
+ * size of the QTextLayout objects anyway).
+ * Note that all these numbers are arbitrary.
+ * Also, setting size to 0 is tantamount to disabling the cache.
+ */
+int cache_metrics_width_size = 1 << 19;
+int cache_metrics_breakat_size = 1 << 19;
+// Qt 5.x already has its own caching of QTextLayout objects
+#if (QT_VERSION < 0x05)
+int cache_metrics_qtextlayout_size = 500;
+#else
+int cache_metrics_qtextlayout_size = 0;
+#endif
+
+
 namespace {
 /**
  * Convert a UCS4 character into a QChar.
@@ -73,23 +87,11 @@ inline QChar const ucs4_to_qchar(char_type const ucs4)
 } // anon namespace
 
 
-/*
- * Limit (strwidth|breakat)_cache_ size to 512kB of string data.
- * Limit qtextlayout_cache_ size to 500 elements (we do not know the
- * size of the QTextLayout objects anyway).
- * Note that all these numbers are arbitrary.
- */
 GuiFontMetrics::GuiFontMetrics(QFont const & font)
-	: font_(font), metrics_(font, 0)
-#ifdef CACHE_METRICS_WIDTH
-	, strwidth_cache_(1 << 19)
-#endif
-#ifdef CACHE_METRICS_BREAKAT
-	, breakat_cache_(1 << 19)
-#endif
-#ifdef CACHE_METRICS_QTEXTLAYOUT
-	,  qtextlayout_cache_(500)
-#endif
+	: font_(font), metrics_(font, 0),
+	  strwidth_cache_(cache_metrics_width_size),
+	  breakat_cache_(cache_metrics_breakat_size),
+	  qtextlayout_cache_(cache_metrics_qtextlayout_size)
 {
 }
 
@@ -174,11 +176,8 @@ int GuiFontMetrics::rbearing(char_type c) const
 
 int GuiFontMetrics::width(docstring const & s) const
 {
-#ifdef CACHE_METRICS_WIDTH
-	int * pw = strwidth_cache_[s];
-	if (pw)
-		return *pw;
-#endif
+	if (strwidth_cache_.contains(s))
+		return strwidth_cache_[s];
 	/* For some reason QMetrics::width returns a wrong value with Qt5
 	 * with some arabic text. OTOH, QTextLayout is broken for single
 	 * characters with null width (like \not in mathed). Also, as a
@@ -200,9 +199,7 @@ int GuiFontMetrics::width(docstring const & s) const
 		tl.endLayout();
 		w = int(line.naturalTextWidth());
 	}
-#ifdef CACHE_METRICS_WIDTH
-	strwidth_cache_.insert(s, new int(w), s.size() * sizeof(char_type));
-#endif
+	strwidth_cache_.insert(s, w, s.size() * sizeof(char_type));
 	return w;
 }
 
@@ -225,31 +222,26 @@ int GuiFontMetrics::signedWidth(docstring const & s) const
 }
 
 
-QTextLayout const *
+shared_ptr
 GuiFontMetrics::getTextLayout(docstring const & s, bool const rtl,
   double const wordspacing) const
 {
-	QTextLayout * ptl;
-#ifdef CACHE_METRICS_QTEXTLAYOUT
-	docstring const s_cache = s + (rtl ? "r" : "l") + convert(wordspacing);
-	ptl = qtextlayout_cache_[s_cache];
-	if (!ptl) {
-#endif
-		ptl = new QTextLayout();
-		ptl->setCacheEnabled(true);
-		ptl->setText(toqstr(s));
-		QFont copy = font_;
-		copy.setWordSpacing(wordspacing);
-		ptl->setFont(copy);
-		// Note that both setFlags and the enums are undocumented
-		ptl->setFlags(rtl ? Qt::TextForceRightToLeft : Qt::TextForceLeftToRight);
-		ptl->beginLayout();
-		p

Re: [LyX/master] ctests: update inversion patterns.

2017-02-23 Thread Jürgen Spitzmüller
Am Dienstag, den 21.02.2017, 12:01 +0100 schrieb Kornel Benko:
> But now fails also (which previously passed)
>   301 - export/export/latex/arabic_simple_pdf4_systemF (Failed)
>   Missing character: There is no ∗ in font
> Scheherazade/OT:script=arab;language=DFLT;mapping=tex-text;!
>   1771 - export/doc/ar/Intro_pdf4_systemF (Failed)
>   Missing character: There is no ∗ in font
> Scheherazade/OT:script=arab;language=DFLT;mapping=tex-text;!

This one seems fixed with recent TL.

But there is another error with arabic and LuaTeX (don't if it it has
been there before).

Jürgen

> 
>   Kornel

signature.asc
Description: This is a digitally signed message part