Re: Todays 1.6svn crash in various ways when opening existing documents

2007-11-07 Thread José Matos
On Saturday 03 November 2007 05:44:44 Andre Poenitz wrote:
 A solution for back-and-forward conversions in the final script would be
 some 'obsoleted in format n' property. So lyx2lyx would skip parts
 that are obsoleted if the target format has a higher version, yet in
 between it will do the conversion, so all the time it will do the 'Right
 Thing'. Jose'?

  I thought about it before. It is too fancy and error prone. We should not 
forget about the interaction between different obsoletes and so on...

  The present scheme served us well and I don't see a reason to change it (at 
the moment).

 Andre'

-- 
José Abílio


Re: Todays 1.6svn crash in various ways when opening existing documents

2007-11-07 Thread Andre Poenitz
On Wed, Nov 07, 2007 at 01:15:45PM -0500, José Matos wrote:
 On Saturday 03 November 2007 05:44:44 Andre Poenitz wrote:
  A solution for back-and-forward conversions in the final script would be
  some 'obsoleted in format n' property. So lyx2lyx would skip parts
  that are obsoleted if the target format has a higher version, yet in
  between it will do the conversion, so all the time it will do the 'Right
  Thing'. Jose'?
 
   I thought about it before. It is too fancy and error prone. We should not 
 forget about the interaction between different obsoletes and so on...
 
   The present scheme served us well and I don't see a reason to change it (at 
 the moment).

Fine with me.

Andre'


Re: Todays 1.6svn crash in various ways when opening existing documents

2007-11-07 Thread José Matos
On Saturday 03 November 2007 05:44:44 Andre Poenitz wrote:
> A solution for back-and-forward conversions in the final script would be
> some 'obsoleted in format n' property. So lyx2lyx would skip parts
> that are obsoleted if the target format has a higher version, yet in
> between it will do the conversion, so all the time it will do the 'Right
> Thing'. Jose'?

  I thought about it before. It is too fancy and error prone. We should not 
forget about the interaction between different obsoletes and so on...

  The present scheme served us well and I don't see a reason to change it (at 
the moment).

> Andre'

-- 
José Abílio


Re: Todays 1.6svn crash in various ways when opening existing documents

2007-11-07 Thread Andre Poenitz
On Wed, Nov 07, 2007 at 01:15:45PM -0500, José Matos wrote:
> On Saturday 03 November 2007 05:44:44 Andre Poenitz wrote:
> > A solution for back-and-forward conversions in the final script would be
> > some 'obsoleted in format n' property. So lyx2lyx would skip parts
> > that are obsoleted if the target format has a higher version, yet in
> > between it will do the conversion, so all the time it will do the 'Right
> > Thing'. Jose'?
> 
>   I thought about it before. It is too fancy and error prone. We should not 
> forget about the interaction between different obsoletes and so on...
> 
>   The present scheme served us well and I don't see a reason to change it (at 
> the moment).

Fine with me.

Andre'


Re: Todays 1.6svn crash in various ways when opening existing documents

2007-11-03 Thread Jürgen Spitzmüller
Bo Peng wrote:
 During a fast-evolving period like this, with no public release in
 between, reversion of lyx2lyx is IMHO acceptable

I think we discussed this sufficiently now. It doesn't matter in which release 
perdiod we are. 

Jürgen


Re: Todays 1.6svn crash in various ways when opening existing documents

2007-11-03 Thread Andre Poenitz
On Sat, Nov 03, 2007 at 01:12:24AM +0200, Martin Vermeer wrote:
 On Sat, Nov 03, 2007 at 12:00:42AM +0100, Abdelrazak Younes wrote:
 
 ...
 
OK, I've done some cleanup an the crashes are gone but the inset 
   layouts 
   are  broken!
  
Martin, Richard, do you have an idea here? I don't know if we shall we 
   fix  Inset::getLayout() or if we shall assume that each inset hard-code 
   its own  layout.
  
Help please,
Abdel.
   Abdel,
   this is precisely the way _not_ to do it. The calls to setLayout() in the 
   various insets are designed (by Jean-Marc during the Bromarv meeting) to 
   get precisely the right insetlayout based on the inset's name().
  
   Year I noticed that... calling virtual methods in ctors is dangerous and 
   should be avoided.
 
 OK...

Well, it has a well-defined semantics (the incarnation of the currently
constructed part is called). It's not 'dangerous' but usually not too
helpful.

Andre'


Re: Todays 1.6svn crash in various ways when opening existing documents

2007-11-03 Thread Andre Poenitz
On Sat, Nov 03, 2007 at 12:29:39AM +0100, Uwe Stöhr wrote:
  During a fast-evolving period like this, with no public release in
  between, reversion of lyx2lyx is IMHO acceptable.

 But this introduces crashed: I can for example not open Stefan's macro 
 example file, see my just sent post on the list.

A solution for back-and-forward conversions in the final script would be
some 'obsoleted in format n' property. So lyx2lyx would skip parts
that are obsoleted if the target format has a higher version, yet in
between it will do the conversion, so all the time it will do the 'Right
Thing'. Jose'?

Andre'


Re: Todays 1.6svn crash in various ways when opening existing documents

2007-11-03 Thread Abdelrazak Younes

Andre Poenitz wrote:

On Sat, Nov 03, 2007 at 01:12:24AM +0200, Martin Vermeer wrote:

On Sat, Nov 03, 2007 at 12:00:42AM +0100, Abdelrazak Younes wrote:

...

 OK, I've done some cleanup an the crashes are gone but the inset layouts 
are  broken!


 Martin, Richard, do you have an idea here? I don't know if we shall we 
fix  Inset::getLayout() or if we shall assume that each inset hard-code 
its own  layout.


 Help please,
 Abdel.

Abdel,
this is precisely the way _not_ to do it. The calls to setLayout() in the 
various insets are designed (by Jean-Marc during the Bromarv meeting) to 
get precisely the right insetlayout based on the inset's name().
 Year I noticed that... calling virtual methods in ctors is dangerous and 
 should be avoided.

OK...


Well, it has a well-defined semantics (the incarnation of the currently
constructed part is called).


I know but I sometimes forgot that in the past.


It's not 'dangerous' but usually not too
helpful.


Well it was not really dangerous but when your code relies on the 
inheriting class calling a virtual method without enforcing it can 
result in crashes.


Abdel.



Re: Todays 1.6svn crash in various ways when opening existing documents

2007-11-03 Thread Jürgen Spitzmüller
Bo Peng wrote:
> During a fast-evolving period like this, with no public release in
> between, reversion of lyx2lyx is IMHO acceptable

I think we discussed this sufficiently now. It doesn't matter in which release 
perdiod we are. 

Jürgen


Re: Todays 1.6svn crash in various ways when opening existing documents

2007-11-03 Thread Andre Poenitz
On Sat, Nov 03, 2007 at 01:12:24AM +0200, Martin Vermeer wrote:
> On Sat, Nov 03, 2007 at 12:00:42AM +0100, Abdelrazak Younes wrote:
> 
> ...
> 
> > >>  OK, I've done some cleanup an the crashes are gone but the inset 
> > >> layouts 
> > >> are  broken!
> > >>
> > >>  Martin, Richard, do you have an idea here? I don't know if we shall we 
> > >> fix  Inset::getLayout() or if we shall assume that each inset hard-code 
> > >> its own  layout.
> > >>
> > >>  Help please,
> > >>  Abdel.
> > > Abdel,
> > > this is precisely the way _not_ to do it. The calls to setLayout() in the 
> > > various insets are designed (by Jean-Marc during the Bromarv meeting) to 
> > > get precisely the right insetlayout based on the inset's name().
> > 
> >  Year I noticed that... calling virtual methods in ctors is dangerous and 
> >  should be avoided.
> 
> OK...

Well, it has a well-defined semantics (the incarnation of the currently
constructed part is called). It's not 'dangerous' but usually not too
helpful.

Andre'


Re: Todays 1.6svn crash in various ways when opening existing documents

2007-11-03 Thread Andre Poenitz
On Sat, Nov 03, 2007 at 12:29:39AM +0100, Uwe Stöhr wrote:
> > During a fast-evolving period like this, with no public release in
> > between, reversion of lyx2lyx is IMHO acceptable.
>
> But this introduces crashed: I can for example not open Stefan's macro 
> example file, see my just sent post on the list.

A solution for back-and-forward conversions in the final script would be
some 'obsoleted in format n' property. So lyx2lyx would skip parts
that are obsoleted if the target format has a higher version, yet in
between it will do the conversion, so all the time it will do the 'Right
Thing'. Jose'?

Andre'


Re: Todays 1.6svn crash in various ways when opening existing documents

2007-11-03 Thread Abdelrazak Younes

Andre Poenitz wrote:

On Sat, Nov 03, 2007 at 01:12:24AM +0200, Martin Vermeer wrote:

On Sat, Nov 03, 2007 at 12:00:42AM +0100, Abdelrazak Younes wrote:

...

 OK, I've done some cleanup an the crashes are gone but the inset layouts 
are  broken!


 Martin, Richard, do you have an idea here? I don't know if we shall we 
fix  Inset::getLayout() or if we shall assume that each inset hard-code 
its own  layout.


 Help please,
 Abdel.

Abdel,
this is precisely the way _not_ to do it. The calls to setLayout() in the 
various insets are designed (by Jean-Marc during the Bromarv meeting) to 
get precisely the right insetlayout based on the inset's name().
 Year I noticed that... calling virtual methods in ctors is dangerous and 
 should be avoided.

OK...


Well, it has a well-defined semantics (the incarnation of the currently
constructed part is called).


I know but I sometimes forgot that in the past.


It's not 'dangerous' but usually not too
helpful.


Well it was not really dangerous but when your code relies on the 
inheriting class calling a virtual method without enforcing it can 
result in crashes.


Abdel.



Re: Todays 1.6svn crash in various ways when opening existing documents

2007-11-02 Thread Helge Hafting

Bo Peng wrote:

On Nov 2, 2007 6:45 AM, Helge Hafting [EMAIL PROTECTED] wrote:
  

Start lyx, open a recent document - assert.

Case one (A11.lyx, beamer presentation)

Handling unknown body token: `\begin_manifest'
Handling unknown body token: `\end_manifest'
Handling unknown body token: `\begin_manifest'
Handling unknown body token: `\end_manifest'



This will not crash lyx but please manually remove \begin_manifest to
\end_manifest from your lyx file. This section has been removed and I
have removed such lines from our documentations.
  

I can do that, no problem.
I though lyx2lyx would do such things anyway though,
or that the unknown stuff would be lost the next time I save
a changed file?

Helge Hafting




Re: Todays 1.6svn crash in various ways when opening existing documents

2007-11-02 Thread Bo Peng
On Nov 2, 2007 6:45 AM, Helge Hafting [EMAIL PROTECTED] wrote:
 Start lyx, open a recent document - assert.

 Case one (A11.lyx, beamer presentation)

 Handling unknown body token: `\begin_manifest'
 Handling unknown body token: `\end_manifest'
 Handling unknown body token: `\begin_manifest'
 Handling unknown body token: `\end_manifest'

This will not crash lyx but please manually remove \begin_manifest to
\end_manifest from your lyx file. This section has been removed and I
have removed such lines from our documentations.

Bo


Re: Todays 1.6svn crash in various ways when opening existing documents

2007-11-02 Thread Abdelrazak Younes

Martin Vermeer wrote:

On Fri, Nov 02, 2007 at 12:45:49PM +0100, Helge Hafting wrote:

 Start lyx, open a recent document - assert.

 Case one (A11.lyx, beamer presentation)


... 
 

 Program received signal SIGSEGV, Segmentation fault.
 [Switching to Thread 0xa62949b0 (LWP 10363)]
 0x0832ec16 in lyx::InsetCollapsable::dimensionCollapsed (this=0x8c5a5e8)
at ../../lyx-devel/src/insets/InsetCollapsable.cpp:178
 178 layout_.labelstring, dim.wid, dim.asc, dim.des);
 (gdb) bt
 #0  0x0832ec16 in lyx::InsetCollapsable::dimensionCollapsed (this=0x8c5a5e8)
at ../../lyx-devel/src/insets/InsetCollapsable.cpp:178
 #1  0x083301ef in lyx::InsetCollapsable::metrics (this=0x8c5a5e8,
[EMAIL PROTECTED], [EMAIL PROTECTED])
at ../../lyx-devel/src/insets/InsetCollapsable.cpp:218
 #2  0x0834eca8 in lyx::InsetFootlike::metrics (this=0x8c5a5e8, 
 [EMAIL PROTECTED],


This is similar to the earlier reported bug for ERT.

From memory (I am travelling) the fix is to replace the call
in the constructor to InsetCollapse(bp) or ...(bp, status)
by ...(bp, collapse). In ERT, Footlike, perhaps more.

There is something fishy here that needs fixing at a more
fundamental level, but please try this first as I cannot do
much from here now.


The problems seems to lie in the default InsetLayout. I guess 
layout_.labelfont needs to be realized before being passed to the 
theFontMetrics?


Dimension InsetCollapsable::dimensionCollapsed() const
{
Dimension dim;
theFontMetrics(layout_.labelfont).buttonText(
layout_.labelstring, dim.wid, dim.asc, dim.des);
return dim;
}

Abdel.



Re: Todays 1.6svn crash in various ways when opening existing documents

2007-11-02 Thread Bo Peng
 I can do that, no problem.
 I though lyx2lyx would do such things anyway though,

I did not want to complicate lyx2lyx by adding another reversion
function to remove this section.

 or that the unknown stuff would be lost the next time I save
 a changed file?

Yes. (But the trunk crashes quite often now).

Bo


Re: Todays 1.6svn crash in various ways when opening existing documents

2007-11-02 Thread Martin Vermeer
On Fri, Nov 02, 2007 at 12:45:49PM +0100, Helge Hafting wrote:
  Start lyx, open a recent document - assert.
 
  Case one (A11.lyx, beamer presentation)

... 
 
  Program received signal SIGSEGV, Segmentation fault.
  [Switching to Thread 0xa62949b0 (LWP 10363)]
  0x0832ec16 in lyx::InsetCollapsable::dimensionCollapsed (this=0x8c5a5e8)
 at ../../lyx-devel/src/insets/InsetCollapsable.cpp:178
  178 layout_.labelstring, dim.wid, dim.asc, dim.des);
  (gdb) bt
  #0  0x0832ec16 in lyx::InsetCollapsable::dimensionCollapsed (this=0x8c5a5e8)
 at ../../lyx-devel/src/insets/InsetCollapsable.cpp:178
  #1  0x083301ef in lyx::InsetCollapsable::metrics (this=0x8c5a5e8,
 [EMAIL PROTECTED], [EMAIL PROTECTED])
 at ../../lyx-devel/src/insets/InsetCollapsable.cpp:218
  #2  0x0834eca8 in lyx::InsetFootlike::metrics (this=0x8c5a5e8, 
  [EMAIL PROTECTED],

This is similar to the earlier reported bug for ERT.

From memory (I am travelling) the fix is to replace the call
in the constructor to InsetCollapse(bp) or ...(bp, status)
by ...(bp, collapse). In ERT, Footlike, perhaps more.

There is something fishy here that needs fixing at a more
fundamental level, but please try this first as I cannot do
much from here now.

- Martin


Re: Todays 1.6svn crash in various ways when opening existing documents

2007-11-02 Thread Abdelrazak Younes

Martin Vermeer wrote:

On Fri, Nov 02, 2007 at 12:45:49PM +0100, Helge Hafting wrote:

 Start lyx, open a recent document - assert.

 Case one (A11.lyx, beamer presentation)


... 
 

 Program received signal SIGSEGV, Segmentation fault.
 [Switching to Thread 0xa62949b0 (LWP 10363)]
 0x0832ec16 in lyx::InsetCollapsable::dimensionCollapsed (this=0x8c5a5e8)
at ../../lyx-devel/src/insets/InsetCollapsable.cpp:178
 178 layout_.labelstring, dim.wid, dim.asc, dim.des);
 (gdb) bt
 #0  0x0832ec16 in lyx::InsetCollapsable::dimensionCollapsed (this=0x8c5a5e8)
at ../../lyx-devel/src/insets/InsetCollapsable.cpp:178
 #1  0x083301ef in lyx::InsetCollapsable::metrics (this=0x8c5a5e8,
[EMAIL PROTECTED], [EMAIL PROTECTED])
at ../../lyx-devel/src/insets/InsetCollapsable.cpp:218
 #2  0x0834eca8 in lyx::InsetFootlike::metrics (this=0x8c5a5e8, 
 [EMAIL PROTECTED],


This is similar to the earlier reported bug for ERT.

From memory (I am travelling) the fix is to replace the call
in the constructor to InsetCollapse(bp) or ...(bp, status)
by ...(bp, collapse). In ERT, Footlike, perhaps more.

There is something fishy here that needs fixing at a more
fundamental level, but please try this first as I cannot do
much from here now.


OK, I've done some cleanup an the crashes are gone but the inset layouts 
are broken!


Martin, Richard, do you have an idea here? I don't know if we shall we 
fix Inset::getLayout() or if we shall assume that each inset hard-code 
its own layout.


Help please,
Abdel.


Author: younes
Date: Fri Nov  2 18:47:51 2007
New Revision: 21382

URL: http://www.lyx.org/trac/changeset/21382
Log:
* InsetCollapsable:
- InsetCollapsable(): Move labelfont initialisation to 
InsetCollapsable::setLayout().

- read(): reset the inset layout.

All other insets: get rid of redundant setLayout() calls.

This commit fixes the multiple crashes in trunk but the color used for 
text and background are completely wrong...


Modified:
lyx-devel/trunk/src/insets/InsetBox.cpp
lyx-devel/trunk/src/insets/InsetBranch.cpp
lyx-devel/trunk/src/insets/InsetCollapsable.cpp
lyx-devel/trunk/src/insets/InsetERT.cpp
lyx-devel/trunk/src/insets/InsetFoot.cpp
lyx-devel/trunk/src/insets/InsetIndex.cpp
lyx-devel/trunk/src/insets/InsetListings.cpp
lyx-devel/trunk/src/insets/InsetMarginal.cpp
lyx-devel/trunk/src/insets/InsetNote.cpp

Modified: lyx-devel/trunk/src/insets/InsetBox.cpp
URL: 
http://www.lyx.org/trac/file/lyx-devel/trunk/src/insets/InsetBox.cpp?rev=21382

==
--- lyx-devel/trunk/src/insets/InsetBox.cpp (original)
+++ lyx-devel/trunk/src/insets/InsetBox.cpp Fri Nov  2 18:47:51 2007
@@ -94,7 +94,6 @@
 InsetBox::InsetBox(BufferParams const  bp, string const  label)
: InsetCollapsable(bp), params_(label)
 {
-   setLayout(bp);
init();
 }

@@ -135,7 +134,6 @@
 {
params_.read(lex);
InsetCollapsable::read(buf, lex);
-   setLayout(buf.params());
setButtonLabel();
 }


Modified: lyx-devel/trunk/src/insets/InsetBranch.cpp
URL: 
http://www.lyx.org/trac/file/lyx-devel/trunk/src/insets/InsetBranch.cpp?rev=21382

==
--- lyx-devel/trunk/src/insets/InsetBranch.cpp (original)
+++ lyx-devel/trunk/src/insets/InsetBranch.cpp Fri Nov  2 18:47:51 2007
@@ -45,7 +45,6 @@
 InsetBranchParams const  params)
: InsetCollapsable(bp), params_(params)
 {
-   setLayout(bp);
init();
 }

@@ -86,8 +85,6 @@
 {
params_.read(lex);
InsetCollapsable::read(buf, lex);
-   setLayout(buf.params());
-   setButtonLabel();
 }


@@ -137,7 +134,6 @@
InsetBranchMailer::string2params(to_utf8(cmd.argument()), 
params);
params_.branch = params.branch;
setLayout(cur.buffer().params());
-   setButtonLabel();
break;
}


Modified: lyx-devel/trunk/src/insets/InsetCollapsable.cpp
URL: 
http://www.lyx.org/trac/file/lyx-devel/trunk/src/insets/InsetCollapsable.cpp?rev=21382

==
--- lyx-devel/trunk/src/insets/InsetCollapsable.cpp (original)
+++ lyx-devel/trunk/src/insets/InsetCollapsable.cpp Fri Nov  2 18:47:51 2007
@@ -82,14 +82,7 @@
setDrawFrame(true);
setFrameColor(Color_collapsableframe);
setButtonLabel();
-   // Fallback for lacking inset layout item
-   layout_.bgcolor = Color_background;
-
-   // FIXME: it seems some insets don't properly initialise that!
-   layout_.labelfont = sane_font;
-   layout_.labelfont.decSize();
-   layout_.labelfont.decSize();
-   layout_.labelfont.setColor(Color_collapsable);
+   setLayout(bp);
 }


@@ -110,7 +103,25 @@

 void  InsetCollapsable::setLayout(BufferParams const  bp)
 {
+   // Fallback for lacking inset 

Re: Todays 1.6svn crash in various ways when opening existing documents

2007-11-02 Thread Abdelrazak Younes

Abdelrazak Younes wrote:

OK, I've done some cleanup an the crashes are gone but the inset layouts 
are broken!


Martin, Richard, do you have an idea here? I don't know if we shall we 
fix Inset::getLayout() or if we shall assume that each inset hard-code 
its own layout.


OK, I see that the font definitions comes from 'lib/stdinsets.inc'. For 
example we have this for footnotes:


InsetLayout Foot
LabelString   foot
LatexType command
LatexName footnote
Font
  Color   foreground
  SizeSmall
  Family  Roman
  Shape   Up
  Series  Medium
  MiscNo_Emph
  MiscNo_Noun
  MiscNo_Bar
EndFont
LabelFont
  Color   Green
  SizeSmall
EndFont
MultiPar  true
End

It seems that this is not properly parsed then. I am going to remove the 
work around in the code so that we can fix the parsing instead.


Abdel.



Re: Todays 1.6svn crash in various ways when opening existing documents

2007-11-02 Thread Uwe Stöhr

 I can do that, no problem.
 I though lyx2lyx would do such things anyway though,

 I did not want to complicate lyx2lyx by adding another reversion
 function to remove this section.

This won't complicate lyx2lyx, that's what lyx2lyx is for. Removing stuff manually from a LyX file 
using an editor is no option!


When you tell me what need to be changed, I can implement this as I think this 
is not complicated.

regards Uwe


Re: Todays 1.6svn crash in various ways when opening existing documents

2007-11-02 Thread Bo Peng
On Nov 2, 2007 3:47 PM, Uwe Stöhr [EMAIL PROTECTED] wrote:
   I can do that, no problem.
   I though lyx2lyx would do such things anyway though,
  
   I did not want to complicate lyx2lyx by adding another reversion
   function to remove this section.

 This won't complicate lyx2lyx, that's what lyx2lyx is for. Removing stuff 
 manually from a LyX file
 using an editor is no option!

During a fast-evolving period like this, with no public release in
between, reversion of lyx2lyx is IMHO acceptable. In this particular
case, if version 250 adds the manifest section, and 260 removes this
section, all 1.5.0 to 1.6.0 conversion will go through this useless
addition and removal, so I reverted part of version 250 (I do not
remember the exact format number).

Cheers,
Bo


Re: Todays 1.6svn crash in various ways when opening existing documents

2007-11-02 Thread Martin Vermeer
On Fri, Nov 02, 2007 at 06:51:54PM +0100, Abdelrazak Younes wrote:
  Martin Vermeer wrote:
  On Fri, Nov 02, 2007 at 12:45:49PM +0100, Helge Hafting wrote:
   Start lyx, open a recent document - assert.
 
   Case one (A11.lyx, beamer presentation)
  ...  
   Program received signal SIGSEGV, Segmentation fault.
   [Switching to Thread 0xa62949b0 (LWP 10363)]
   0x0832ec16 in lyx::InsetCollapsable::dimensionCollapsed (this=0x8c5a5e8)
  at ../../lyx-devel/src/insets/InsetCollapsable.cpp:178
   178 layout_.labelstring, dim.wid, dim.asc, dim.des);
   (gdb) bt
   #0  0x0832ec16 in lyx::InsetCollapsable::dimensionCollapsed 
  (this=0x8c5a5e8)
  at ../../lyx-devel/src/insets/InsetCollapsable.cpp:178
   #1  0x083301ef in lyx::InsetCollapsable::metrics (this=0x8c5a5e8,
  [EMAIL PROTECTED], [EMAIL PROTECTED])
  at ../../lyx-devel/src/insets/InsetCollapsable.cpp:218
   #2  0x0834eca8 in lyx::InsetFootlike::metrics (this=0x8c5a5e8,  
  [EMAIL PROTECTED],
  This is similar to the earlier reported bug for ERT.
  From memory (I am travelling) the fix is to replace the call
  in the constructor to InsetCollapse(bp) or ...(bp, status)
  by ...(bp, collapse). In ERT, Footlike, perhaps more.
  There is something fishy here that needs fixing at a more
  fundamental level, but please try this first as I cannot do
  much from here now.
 
  OK, I've done some cleanup an the crashes are gone but the inset layouts are 
  broken!
 
  Martin, Richard, do you have an idea here? I don't know if we shall we fix 
  Inset::getLayout() or if we shall assume that each inset hard-code its own 
  layout.
 
  Help please,
  Abdel.

Abdel,

this is precisely the way _not_ to do it. The calls to 
setLayout() in the various insets are designed (by Jean-Marc 
during the Bromarv meeting) to get precisely the right 
insetlayout based on the inset's name().

I fought with this fruitlessly until Jean-Marc showed me. You
reverted to my old non-working code :-(

Also, you shouldn't modify layout_ from within the inset. 
(can this be enforced by const?).

Can you not simply fully realize the labelfont (or a  local
copy) before using it in dimensionCollapsed()? A minimal fix.

- Martin



Re: Todays 1.6svn crash in various ways when opening existing documents

2007-11-02 Thread Abdelrazak Younes

Martin Vermeer wrote:

On Fri, Nov 02, 2007 at 06:51:54PM +0100, Abdelrazak Younes wrote:

 Martin Vermeer wrote:

On Fri, Nov 02, 2007 at 12:45:49PM +0100, Helge Hafting wrote:

 Start lyx, open a recent document - assert.

 Case one (A11.lyx, beamer presentation)
...  

 Program received signal SIGSEGV, Segmentation fault.
 [Switching to Thread 0xa62949b0 (LWP 10363)]
 0x0832ec16 in lyx::InsetCollapsable::dimensionCollapsed (this=0x8c5a5e8)
at ../../lyx-devel/src/insets/InsetCollapsable.cpp:178
 178 layout_.labelstring, dim.wid, dim.asc, dim.des);
 (gdb) bt
 #0  0x0832ec16 in lyx::InsetCollapsable::dimensionCollapsed 
(this=0x8c5a5e8)

at ../../lyx-devel/src/insets/InsetCollapsable.cpp:178
 #1  0x083301ef in lyx::InsetCollapsable::metrics (this=0x8c5a5e8,
[EMAIL PROTECTED], [EMAIL PROTECTED])
at ../../lyx-devel/src/insets/InsetCollapsable.cpp:218
 #2  0x0834eca8 in lyx::InsetFootlike::metrics (this=0x8c5a5e8,  
[EMAIL PROTECTED],

This is similar to the earlier reported bug for ERT.
From memory (I am travelling) the fix is to replace the call
in the constructor to InsetCollapse(bp) or ...(bp, status)
by ...(bp, collapse). In ERT, Footlike, perhaps more.
There is something fishy here that needs fixing at a more
fundamental level, but please try this first as I cannot do
much from here now.
 OK, I've done some cleanup an the crashes are gone but the inset layouts are 
 broken!


 Martin, Richard, do you have an idea here? I don't know if we shall we fix 
 Inset::getLayout() or if we shall assume that each inset hard-code its own 
 layout.


 Help please,
 Abdel.


Abdel,

this is precisely the way _not_ to do it. The calls to 
setLayout() in the various insets are designed (by Jean-Marc 
during the Bromarv meeting) to get precisely the right 
insetlayout based on the inset's name().


Year I noticed that... calling virtual methods in ctors is dangerous and 
should be avoided.




I fought with this fruitlessly until Jean-Marc showed me. You
reverted to my old non-working code :-(


Calm down, I found a better solution (appended below, I guess you cannot 
read lyx-cvs?).




Also, you shouldn't modify layout_ from within the inset. 
(can this be enforced by const?).


We can do that yes.



Can you not simply fully realize the labelfont (or a  local
copy) before using it in dimensionCollapsed()? A minimal fix.


I fixed it by realizing it at setLayout() time. It works fine now but 
some insets don't have entry in stdinsets.inc.


Abdel.


Author: younes
Date: Fri Nov  2 22:27:41 2007
New Revision: 21392

URL: http://www.lyx.org/trac/changeset/21392
Log:
Further cleanup of collapsable insets. The layouts are now properly read 
and applied.



Modified:
lyx-devel/trunk/src/Text3.cpp
lyx-devel/trunk/src/insets/Inset.h
lyx-devel/trunk/src/insets/InsetBox.cpp
lyx-devel/trunk/src/insets/InsetCollapsable.cpp
lyx-devel/trunk/src/insets/InsetCollapsable.h

Modified: lyx-devel/trunk/src/Text3.cpp
URL: http://www.lyx.org/trac/file/lyx-devel/trunk/src/Text3.cpp?rev=21392
==
--- lyx-devel/trunk/src/Text3.cpp (original)
+++ lyx-devel/trunk/src/Text3.cpp Fri Nov  2 22:27:41 2007
@@ -189,6 +189,9 @@
Inset * inset = createInset(cur.bv(), cmd);
if (!inset)
return false;
+
+   if (InsetCollapsable * ci = inset-asInsetCollapsable())
+   ci-setLayout(cur.bv().buffer().params());

cur.recordUndo();
if (cmd.action == LFUN_INDEX_INSERT) {

Modified: lyx-devel/trunk/src/insets/Inset.h
URL: 
http://www.lyx.org/trac/file/lyx-devel/trunk/src/insets/Inset.h?rev=21392

==
--- lyx-devel/trunk/src/insets/Inset.h (original)
+++ lyx-devel/trunk/src/insets/Inset.h Fri Nov  2 22:27:41 2007
@@ -35,6 +35,7 @@
 class FuncRequest;
 class FuncStatus;
 class InsetIterator;
+class InsetCollapsable;
 class InsetLayout;
 class InsetList;
 class InsetMath;
@@ -88,6 +89,10 @@
virtual InsetText * asTextInset() { return 0; }
/// is this inset based on the TextInset class?
virtual InsetText const * asTextInset() const { return 0; }
+   /// is this inset based on the InsetCollapsable class?
+   virtual InsetCollapsable * asInsetCollapsable() { return 0; }
+   /// is this inset based on the InsetCollapsable class?
+   virtual InsetCollapsable const * asInsetCollapsable() const { return 0; 
}

/// the real dispatcher
void dispatch(Cursor  cur, FuncRequest  cmd);

Modified: lyx-devel/trunk/src/insets/InsetBox.cpp
URL: 
http://www.lyx.org/trac/file/lyx-devel/trunk/src/insets/InsetBox.cpp?rev=21392

==
--- lyx-devel/trunk/src/insets/InsetBox.cpp (original)
+++ lyx-devel/trunk/src/insets/InsetBox.cpp Fri Nov  2 22:27:41 2007
@@ -199,7 +199,6 @@
 

Re: Todays 1.6svn crash in various ways when opening existing documents

2007-11-02 Thread Martin Vermeer
On Sat, Nov 03, 2007 at 12:00:42AM +0100, Abdelrazak Younes wrote:

...

   OK, I've done some cleanup an the crashes are gone but the inset layouts 
  are  broken!
 
   Martin, Richard, do you have an idea here? I don't know if we shall we 
  fix  Inset::getLayout() or if we shall assume that each inset hard-code 
  its own  layout.
 
   Help please,
   Abdel.
  Abdel,
  this is precisely the way _not_ to do it. The calls to setLayout() in the 
  various insets are designed (by Jean-Marc during the Bromarv meeting) to 
  get precisely the right insetlayout based on the inset's name().
 
  Year I noticed that... calling virtual methods in ctors is dangerous and 
  should be avoided.

OK...

  I fought with this fruitlessly until Jean-Marc showed me. You
  reverted to my old non-working code :-(
 
  Calm down, I found a better solution (appended below, I guess you cannot 
  read lyx-cvs?).

Yes, but I didn't notice until later. Looks like you got it
working again (?) but the thingy in Text3.cpp doesn't look
pretty.

  Also, you shouldn't modify layout_ from within the inset. (can this be 
  enforced by const?).
 
  We can do that yes.

Would be a good thing.
 
  Can you not simply fully realize the labelfont (or a  local
  copy) before using it in dimensionCollapsed()? A minimal fix.
 
  I fixed it by realizing it at setLayout() time. It works fine now but some 
  insets don't have entry in stdinsets.inc.

OK... but I agree with your suspicion that this is better
done in insetlayout parsing.
 
  Abdel.

- Martin



Re: Todays 1.6svn crash in various ways when opening existing documents

2007-11-02 Thread Abdelrazak Younes

Martin Vermeer wrote:

On Sat, Nov 03, 2007 at 12:00:42AM +0100, Abdelrazak Younes wrote:

...

I fought with this fruitlessly until Jean-Marc showed me. You
reverted to my old non-working code :-(
 Calm down, I found a better solution (appended below, I guess you cannot 
 read lyx-cvs?).


Yes, but I didn't notice until later. Looks like you got it
working again (?)


Yes.


but the thingy in Text3.cpp doesn't look
pretty.


Really? In any case, I don't think we need to set the layout. Why not 
just accessing it through Inset::getLayout() when we need it? This will 
avoid an unnecessary copy and get rid of the layout_ member altogether.




Also, you shouldn't modify layout_ from within the inset. (can this be 
enforced by const?).

 We can do that yes.


Would be a good thing.


Or see above.



Can you not simply fully realize the labelfont (or a  local
copy) before using it in dimensionCollapsed()? A minimal fix.
 I fixed it by realizing it at setLayout() time. It works fine now but some 
 insets don't have entry in stdinsets.inc.


OK... but I agree with your suspicion that this is better
done in insetlayout parsing.


I'll do that.

Abdel.



Re: Todays 1.6svn crash in various ways when opening existing documents

2007-11-02 Thread Uwe Stöhr

 During a fast-evolving period like this, with no public release in
 between, reversion of lyx2lyx is IMHO acceptable.

But this introduces crashed: I can for example not open Stefan's macro example file, see my just 
sent post on the list.


Besides this we have the general problem that LyX can crash when a file is not in the right format. 
This definitively should not happen; no matter what format the file is, LyX should display an error 
message that the file is broken or whatever, but not crash.
This could be done when LyX is using a try .. finally routine in the file open code. I'm not 
experienced how this is done in C++, but something should be done in this field.


regards uwe


Re: Todays 1.6svn crash in various ways when opening existing documents

2007-11-02 Thread Bo Peng
 But this introduces crashed: I can for example not open Stefan's macro 
 example file, see my just
 sent post on the list.

As far as I know, today's crash is caused by some insets, not \begin manifest.

Bo


Re: Todays 1.6svn crash in various ways when opening existing documents

2007-11-02 Thread Helge Hafting

Bo Peng wrote:

On Nov 2, 2007 6:45 AM, Helge Hafting <[EMAIL PROTECTED]> wrote:
  

Start lyx, open a "recent document" - assert.

Case one (A11.lyx, beamer presentation)

Handling unknown body token: `\begin_manifest'
Handling unknown body token: `\end_manifest'
Handling unknown body token: `\begin_manifest'
Handling unknown body token: `\end_manifest'



This will not crash lyx but please manually remove \begin_manifest to
\end_manifest from your lyx file. This section has been removed and I
have removed such lines from our documentations.
  

I can do that, no problem.
I though lyx2lyx would do such things anyway though,
or that the unknown stuff would be lost the next time I save
a changed file?

Helge Hafting




Re: Todays 1.6svn crash in various ways when opening existing documents

2007-11-02 Thread Bo Peng
On Nov 2, 2007 6:45 AM, Helge Hafting <[EMAIL PROTECTED]> wrote:
> Start lyx, open a "recent document" - assert.
>
> Case one (A11.lyx, beamer presentation)
>
> Handling unknown body token: `\begin_manifest'
> Handling unknown body token: `\end_manifest'
> Handling unknown body token: `\begin_manifest'
> Handling unknown body token: `\end_manifest'

This will not crash lyx but please manually remove \begin_manifest to
\end_manifest from your lyx file. This section has been removed and I
have removed such lines from our documentations.

Bo


Re: Todays 1.6svn crash in various ways when opening existing documents

2007-11-02 Thread Abdelrazak Younes

Martin Vermeer wrote:

On Fri, Nov 02, 2007 at 12:45:49PM +0100, Helge Hafting wrote:

 Start lyx, open a "recent document" - assert.

 Case one (A11.lyx, beamer presentation)


... 
 

 Program received signal SIGSEGV, Segmentation fault.
 [Switching to Thread 0xa62949b0 (LWP 10363)]
 0x0832ec16 in lyx::InsetCollapsable::dimensionCollapsed (this=0x8c5a5e8)
at ../../lyx-devel/src/insets/InsetCollapsable.cpp:178
 178 layout_.labelstring, dim.wid, dim.asc, dim.des);
 (gdb) bt
 #0  0x0832ec16 in lyx::InsetCollapsable::dimensionCollapsed (this=0x8c5a5e8)
at ../../lyx-devel/src/insets/InsetCollapsable.cpp:178
 #1  0x083301ef in lyx::InsetCollapsable::metrics (this=0x8c5a5e8,
[EMAIL PROTECTED], [EMAIL PROTECTED])
at ../../lyx-devel/src/insets/InsetCollapsable.cpp:218
 #2  0x0834eca8 in lyx::InsetFootlike::metrics (this=0x8c5a5e8, 
 [EMAIL PROTECTED],


This is similar to the earlier reported bug for ERT.

From memory (I am travelling) the fix is to replace the call
in the constructor to InsetCollapse(bp) or ...(bp, status)
by ...(bp, collapse). In ERT, Footlike, perhaps more.

There is something fishy here that needs fixing at a more
fundamental level, but please try this first as I cannot do
much from here now.


The problems seems to lie in the default InsetLayout. I guess 
layout_.labelfont needs to be realized before being passed to the 
theFontMetrics?


Dimension InsetCollapsable::dimensionCollapsed() const
{
Dimension dim;
theFontMetrics(layout_.labelfont).buttonText(
layout_.labelstring, dim.wid, dim.asc, dim.des);
return dim;
}

Abdel.



Re: Todays 1.6svn crash in various ways when opening existing documents

2007-11-02 Thread Bo Peng
> I can do that, no problem.
> I though lyx2lyx would do such things anyway though,

I did not want to complicate lyx2lyx by adding another reversion
function to remove this section.

> or that the unknown stuff would be lost the next time I save
> a changed file?

Yes. (But the trunk crashes quite often now).

Bo


Re: Todays 1.6svn crash in various ways when opening existing documents

2007-11-02 Thread Martin Vermeer
On Fri, Nov 02, 2007 at 12:45:49PM +0100, Helge Hafting wrote:
>  Start lyx, open a "recent document" - assert.
> 
>  Case one (A11.lyx, beamer presentation)

... 
 
>  Program received signal SIGSEGV, Segmentation fault.
>  [Switching to Thread 0xa62949b0 (LWP 10363)]
>  0x0832ec16 in lyx::InsetCollapsable::dimensionCollapsed (this=0x8c5a5e8)
> at ../../lyx-devel/src/insets/InsetCollapsable.cpp:178
>  178 layout_.labelstring, dim.wid, dim.asc, dim.des);
>  (gdb) bt
>  #0  0x0832ec16 in lyx::InsetCollapsable::dimensionCollapsed (this=0x8c5a5e8)
> at ../../lyx-devel/src/insets/InsetCollapsable.cpp:178
>  #1  0x083301ef in lyx::InsetCollapsable::metrics (this=0x8c5a5e8,
> [EMAIL PROTECTED], [EMAIL PROTECTED])
> at ../../lyx-devel/src/insets/InsetCollapsable.cpp:218
>  #2  0x0834eca8 in lyx::InsetFootlike::metrics (this=0x8c5a5e8, 
>  [EMAIL PROTECTED],

This is similar to the earlier reported bug for ERT.

>From memory (I am travelling) the fix is to replace the call
in the constructor to InsetCollapse(bp) or ...(bp, status)
by ...(bp, collapse). In ERT, Footlike, perhaps more.

There is something fishy here that needs fixing at a more
fundamental level, but please try this first as I cannot do
much from here now.

- Martin


Re: Todays 1.6svn crash in various ways when opening existing documents

2007-11-02 Thread Abdelrazak Younes

Martin Vermeer wrote:

On Fri, Nov 02, 2007 at 12:45:49PM +0100, Helge Hafting wrote:

 Start lyx, open a "recent document" - assert.

 Case one (A11.lyx, beamer presentation)


... 
 

 Program received signal SIGSEGV, Segmentation fault.
 [Switching to Thread 0xa62949b0 (LWP 10363)]
 0x0832ec16 in lyx::InsetCollapsable::dimensionCollapsed (this=0x8c5a5e8)
at ../../lyx-devel/src/insets/InsetCollapsable.cpp:178
 178 layout_.labelstring, dim.wid, dim.asc, dim.des);
 (gdb) bt
 #0  0x0832ec16 in lyx::InsetCollapsable::dimensionCollapsed (this=0x8c5a5e8)
at ../../lyx-devel/src/insets/InsetCollapsable.cpp:178
 #1  0x083301ef in lyx::InsetCollapsable::metrics (this=0x8c5a5e8,
[EMAIL PROTECTED], [EMAIL PROTECTED])
at ../../lyx-devel/src/insets/InsetCollapsable.cpp:218
 #2  0x0834eca8 in lyx::InsetFootlike::metrics (this=0x8c5a5e8, 
 [EMAIL PROTECTED],


This is similar to the earlier reported bug for ERT.

From memory (I am travelling) the fix is to replace the call
in the constructor to InsetCollapse(bp) or ...(bp, status)
by ...(bp, collapse). In ERT, Footlike, perhaps more.

There is something fishy here that needs fixing at a more
fundamental level, but please try this first as I cannot do
much from here now.


OK, I've done some cleanup an the crashes are gone but the inset layouts 
are broken!


Martin, Richard, do you have an idea here? I don't know if we shall we 
fix Inset::getLayout() or if we shall assume that each inset hard-code 
its own layout.


Help please,
Abdel.


Author: younes
Date: Fri Nov  2 18:47:51 2007
New Revision: 21382

URL: http://www.lyx.org/trac/changeset/21382
Log:
* InsetCollapsable:
- InsetCollapsable(): Move labelfont initialisation to 
InsetCollapsable::setLayout().

- read(): reset the inset layout.

All other insets: get rid of redundant setLayout() calls.

This commit fixes the multiple crashes in trunk but the color used for 
text and background are completely wrong...


Modified:
lyx-devel/trunk/src/insets/InsetBox.cpp
lyx-devel/trunk/src/insets/InsetBranch.cpp
lyx-devel/trunk/src/insets/InsetCollapsable.cpp
lyx-devel/trunk/src/insets/InsetERT.cpp
lyx-devel/trunk/src/insets/InsetFoot.cpp
lyx-devel/trunk/src/insets/InsetIndex.cpp
lyx-devel/trunk/src/insets/InsetListings.cpp
lyx-devel/trunk/src/insets/InsetMarginal.cpp
lyx-devel/trunk/src/insets/InsetNote.cpp

Modified: lyx-devel/trunk/src/insets/InsetBox.cpp
URL: 
http://www.lyx.org/trac/file/lyx-devel/trunk/src/insets/InsetBox.cpp?rev=21382

==
--- lyx-devel/trunk/src/insets/InsetBox.cpp (original)
+++ lyx-devel/trunk/src/insets/InsetBox.cpp Fri Nov  2 18:47:51 2007
@@ -94,7 +94,6 @@
 InsetBox::InsetBox(BufferParams const & bp, string const & label)
: InsetCollapsable(bp), params_(label)
 {
-   setLayout(bp);
init();
 }

@@ -135,7 +134,6 @@
 {
params_.read(lex);
InsetCollapsable::read(buf, lex);
-   setLayout(buf.params());
setButtonLabel();
 }


Modified: lyx-devel/trunk/src/insets/InsetBranch.cpp
URL: 
http://www.lyx.org/trac/file/lyx-devel/trunk/src/insets/InsetBranch.cpp?rev=21382

==
--- lyx-devel/trunk/src/insets/InsetBranch.cpp (original)
+++ lyx-devel/trunk/src/insets/InsetBranch.cpp Fri Nov  2 18:47:51 2007
@@ -45,7 +45,6 @@
 InsetBranchParams const & params)
: InsetCollapsable(bp), params_(params)
 {
-   setLayout(bp);
init();
 }

@@ -86,8 +85,6 @@
 {
params_.read(lex);
InsetCollapsable::read(buf, lex);
-   setLayout(buf.params());
-   setButtonLabel();
 }


@@ -137,7 +134,6 @@
InsetBranchMailer::string2params(to_utf8(cmd.argument()), 
params);
params_.branch = params.branch;
setLayout(cur.buffer().params());
-   setButtonLabel();
break;
}


Modified: lyx-devel/trunk/src/insets/InsetCollapsable.cpp
URL: 
http://www.lyx.org/trac/file/lyx-devel/trunk/src/insets/InsetCollapsable.cpp?rev=21382

==
--- lyx-devel/trunk/src/insets/InsetCollapsable.cpp (original)
+++ lyx-devel/trunk/src/insets/InsetCollapsable.cpp Fri Nov  2 18:47:51 2007
@@ -82,14 +82,7 @@
setDrawFrame(true);
setFrameColor(Color_collapsableframe);
setButtonLabel();
-   // Fallback for lacking inset layout item
-   layout_.bgcolor = Color_background;
-
-   // FIXME: it seems some insets don't properly initialise that!
-   layout_.labelfont = sane_font;
-   layout_.labelfont.decSize();
-   layout_.labelfont.decSize();
-   layout_.labelfont.setColor(Color_collapsable);
+   setLayout(bp);
 }


@@ -110,7 +103,25 @@

 void  InsetCollapsable::setLayout(BufferParams const & bp)
 {
+   // Fallback for lacking 

Re: Todays 1.6svn crash in various ways when opening existing documents

2007-11-02 Thread Abdelrazak Younes

Abdelrazak Younes wrote:

OK, I've done some cleanup an the crashes are gone but the inset layouts 
are broken!


Martin, Richard, do you have an idea here? I don't know if we shall we 
fix Inset::getLayout() or if we shall assume that each inset hard-code 
its own layout.


OK, I see that the font definitions comes from 'lib/stdinsets.inc'. For 
example we have this for footnotes:


InsetLayout Foot
LabelString   foot
LatexType command
LatexName footnote
Font
  Color   foreground
  SizeSmall
  Family  Roman
  Shape   Up
  Series  Medium
  MiscNo_Emph
  MiscNo_Noun
  MiscNo_Bar
EndFont
LabelFont
  Color   Green
  SizeSmall
EndFont
MultiPar  true
End

It seems that this is not properly parsed then. I am going to remove the 
work around in the code so that we can fix the parsing instead.


Abdel.



Re: Todays 1.6svn crash in various ways when opening existing documents

2007-11-02 Thread Uwe Stöhr

>> I can do that, no problem.
>> I though lyx2lyx would do such things anyway though,
>
> I did not want to complicate lyx2lyx by adding another reversion
> function to remove this section.

This won't complicate lyx2lyx, that's what lyx2lyx is for. Removing stuff manually from a LyX file 
using an editor is no option!


When you tell me what need to be changed, I can implement this as I think this 
is not complicated.

regards Uwe


Re: Todays 1.6svn crash in various ways when opening existing documents

2007-11-02 Thread Bo Peng
On Nov 2, 2007 3:47 PM, Uwe Stöhr <[EMAIL PROTECTED]> wrote:
>  >> I can do that, no problem.
>  >> I though lyx2lyx would do such things anyway though,
>  >
>  > I did not want to complicate lyx2lyx by adding another reversion
>  > function to remove this section.
>
> This won't complicate lyx2lyx, that's what lyx2lyx is for. Removing stuff 
> manually from a LyX file
> using an editor is no option!

During a fast-evolving period like this, with no public release in
between, reversion of lyx2lyx is IMHO acceptable. In this particular
case, if version 250 adds the manifest section, and 260 removes this
section, all 1.5.0 to 1.6.0 conversion will go through this useless
addition and removal, so I reverted part of version 250 (I do not
remember the exact format number).

Cheers,
Bo


Re: Todays 1.6svn crash in various ways when opening existing documents

2007-11-02 Thread Martin Vermeer
On Fri, Nov 02, 2007 at 06:51:54PM +0100, Abdelrazak Younes wrote:
>  Martin Vermeer wrote:
> > On Fri, Nov 02, 2007 at 12:45:49PM +0100, Helge Hafting wrote:
> >>  Start lyx, open a "recent document" - assert.
> >>
> >>  Case one (A11.lyx, beamer presentation)
> > ...  
> >>  Program received signal SIGSEGV, Segmentation fault.
> >>  [Switching to Thread 0xa62949b0 (LWP 10363)]
> >>  0x0832ec16 in lyx::InsetCollapsable::dimensionCollapsed (this=0x8c5a5e8)
> >> at ../../lyx-devel/src/insets/InsetCollapsable.cpp:178
> >>  178 layout_.labelstring, dim.wid, dim.asc, dim.des);
> >>  (gdb) bt
> >>  #0  0x0832ec16 in lyx::InsetCollapsable::dimensionCollapsed 
> >> (this=0x8c5a5e8)
> >> at ../../lyx-devel/src/insets/InsetCollapsable.cpp:178
> >>  #1  0x083301ef in lyx::InsetCollapsable::metrics (this=0x8c5a5e8,
> >> [EMAIL PROTECTED], [EMAIL PROTECTED])
> >> at ../../lyx-devel/src/insets/InsetCollapsable.cpp:218
> >>  #2  0x0834eca8 in lyx::InsetFootlike::metrics (this=0x8c5a5e8,  
> >> [EMAIL PROTECTED],
> > This is similar to the earlier reported bug for ERT.
> > From memory (I am travelling) the fix is to replace the call
> > in the constructor to InsetCollapse(bp) or ...(bp, status)
> > by ...(bp, collapse). In ERT, Footlike, perhaps more.
> > There is something fishy here that needs fixing at a more
> > fundamental level, but please try this first as I cannot do
> > much from here now.
> 
>  OK, I've done some cleanup an the crashes are gone but the inset layouts are 
>  broken!
> 
>  Martin, Richard, do you have an idea here? I don't know if we shall we fix 
>  Inset::getLayout() or if we shall assume that each inset hard-code its own 
>  layout.
> 
>  Help please,
>  Abdel.

Abdel,

this is precisely the way _not_ to do it. The calls to 
setLayout() in the various insets are designed (by Jean-Marc 
during the Bromarv meeting) to get precisely the right 
insetlayout based on the inset's name().

I fought with this fruitlessly until Jean-Marc showed me. You
reverted to my old non-working code :-(

Also, you shouldn't modify layout_ from within the inset. 
(can this be enforced by const?).

Can you not simply fully realize the labelfont (or a  local
copy) before using it in dimensionCollapsed()? A minimal fix.

- Martin



Re: Todays 1.6svn crash in various ways when opening existing documents

2007-11-02 Thread Abdelrazak Younes

Martin Vermeer wrote:

On Fri, Nov 02, 2007 at 06:51:54PM +0100, Abdelrazak Younes wrote:

 Martin Vermeer wrote:

On Fri, Nov 02, 2007 at 12:45:49PM +0100, Helge Hafting wrote:

 Start lyx, open a "recent document" - assert.

 Case one (A11.lyx, beamer presentation)
...  

 Program received signal SIGSEGV, Segmentation fault.
 [Switching to Thread 0xa62949b0 (LWP 10363)]
 0x0832ec16 in lyx::InsetCollapsable::dimensionCollapsed (this=0x8c5a5e8)
at ../../lyx-devel/src/insets/InsetCollapsable.cpp:178
 178 layout_.labelstring, dim.wid, dim.asc, dim.des);
 (gdb) bt
 #0  0x0832ec16 in lyx::InsetCollapsable::dimensionCollapsed 
(this=0x8c5a5e8)

at ../../lyx-devel/src/insets/InsetCollapsable.cpp:178
 #1  0x083301ef in lyx::InsetCollapsable::metrics (this=0x8c5a5e8,
[EMAIL PROTECTED], [EMAIL PROTECTED])
at ../../lyx-devel/src/insets/InsetCollapsable.cpp:218
 #2  0x0834eca8 in lyx::InsetFootlike::metrics (this=0x8c5a5e8,  
[EMAIL PROTECTED],

This is similar to the earlier reported bug for ERT.
From memory (I am travelling) the fix is to replace the call
in the constructor to InsetCollapse(bp) or ...(bp, status)
by ...(bp, collapse). In ERT, Footlike, perhaps more.
There is something fishy here that needs fixing at a more
fundamental level, but please try this first as I cannot do
much from here now.
 OK, I've done some cleanup an the crashes are gone but the inset layouts are 
 broken!


 Martin, Richard, do you have an idea here? I don't know if we shall we fix 
 Inset::getLayout() or if we shall assume that each inset hard-code its own 
 layout.


 Help please,
 Abdel.


Abdel,

this is precisely the way _not_ to do it. The calls to 
setLayout() in the various insets are designed (by Jean-Marc 
during the Bromarv meeting) to get precisely the right 
insetlayout based on the inset's name().


Year I noticed that... calling virtual methods in ctors is dangerous and 
should be avoided.




I fought with this fruitlessly until Jean-Marc showed me. You
reverted to my old non-working code :-(


Calm down, I found a better solution (appended below, I guess you cannot 
read lyx-cvs?).




Also, you shouldn't modify layout_ from within the inset. 
(can this be enforced by const?).


We can do that yes.



Can you not simply fully realize the labelfont (or a  local
copy) before using it in dimensionCollapsed()? A minimal fix.


I fixed it by realizing it at setLayout() time. It works fine now but 
some insets don't have entry in stdinsets.inc.


Abdel.


Author: younes
Date: Fri Nov  2 22:27:41 2007
New Revision: 21392

URL: http://www.lyx.org/trac/changeset/21392
Log:
Further cleanup of collapsable insets. The layouts are now properly read 
and applied.



Modified:
lyx-devel/trunk/src/Text3.cpp
lyx-devel/trunk/src/insets/Inset.h
lyx-devel/trunk/src/insets/InsetBox.cpp
lyx-devel/trunk/src/insets/InsetCollapsable.cpp
lyx-devel/trunk/src/insets/InsetCollapsable.h

Modified: lyx-devel/trunk/src/Text3.cpp
URL: http://www.lyx.org/trac/file/lyx-devel/trunk/src/Text3.cpp?rev=21392
==
--- lyx-devel/trunk/src/Text3.cpp (original)
+++ lyx-devel/trunk/src/Text3.cpp Fri Nov  2 22:27:41 2007
@@ -189,6 +189,9 @@
Inset * inset = createInset((), cmd);
if (!inset)
return false;
+
+   if (InsetCollapsable * ci = inset->asInsetCollapsable())
+   ci->setLayout(cur.bv().buffer().params());

cur.recordUndo();
if (cmd.action == LFUN_INDEX_INSERT) {

Modified: lyx-devel/trunk/src/insets/Inset.h
URL: 
http://www.lyx.org/trac/file/lyx-devel/trunk/src/insets/Inset.h?rev=21392

==
--- lyx-devel/trunk/src/insets/Inset.h (original)
+++ lyx-devel/trunk/src/insets/Inset.h Fri Nov  2 22:27:41 2007
@@ -35,6 +35,7 @@
 class FuncRequest;
 class FuncStatus;
 class InsetIterator;
+class InsetCollapsable;
 class InsetLayout;
 class InsetList;
 class InsetMath;
@@ -88,6 +89,10 @@
virtual InsetText * asTextInset() { return 0; }
/// is this inset based on the TextInset class?
virtual InsetText const * asTextInset() const { return 0; }
+   /// is this inset based on the InsetCollapsable class?
+   virtual InsetCollapsable * asInsetCollapsable() { return 0; }
+   /// is this inset based on the InsetCollapsable class?
+   virtual InsetCollapsable const * asInsetCollapsable() const { return 0; 
}

/// the real dispatcher
void dispatch(Cursor & cur, FuncRequest & cmd);

Modified: lyx-devel/trunk/src/insets/InsetBox.cpp
URL: 
http://www.lyx.org/trac/file/lyx-devel/trunk/src/insets/InsetBox.cpp?rev=21392

==
--- lyx-devel/trunk/src/insets/InsetBox.cpp (original)
+++ lyx-devel/trunk/src/insets/InsetBox.cpp Fri Nov  2 22:27:41 2007
@@ -199,7 +199,6 @@
 

Re: Todays 1.6svn crash in various ways when opening existing documents

2007-11-02 Thread Martin Vermeer
On Sat, Nov 03, 2007 at 12:00:42AM +0100, Abdelrazak Younes wrote:

...

> >>  OK, I've done some cleanup an the crashes are gone but the inset layouts 
> >> are  broken!
> >>
> >>  Martin, Richard, do you have an idea here? I don't know if we shall we 
> >> fix  Inset::getLayout() or if we shall assume that each inset hard-code 
> >> its own  layout.
> >>
> >>  Help please,
> >>  Abdel.
> > Abdel,
> > this is precisely the way _not_ to do it. The calls to setLayout() in the 
> > various insets are designed (by Jean-Marc during the Bromarv meeting) to 
> > get precisely the right insetlayout based on the inset's name().
> 
>  Year I noticed that... calling virtual methods in ctors is dangerous and 
>  should be avoided.

OK...

> > I fought with this fruitlessly until Jean-Marc showed me. You
> > reverted to my old non-working code :-(
> 
>  Calm down, I found a better solution (appended below, I guess you cannot 
>  read lyx-cvs?).

Yes, but I didn't notice until later. Looks like you got it
working again (?) but the thingy in Text3.cpp doesn't look
pretty.

> > Also, you shouldn't modify layout_ from within the inset. (can this be 
> > enforced by const?).
> 
>  We can do that yes.

Would be a good thing.
 
> > Can you not simply fully realize the labelfont (or a  local
> > copy) before using it in dimensionCollapsed()? A minimal fix.
> 
>  I fixed it by realizing it at setLayout() time. It works fine now but some 
>  insets don't have entry in stdinsets.inc.

OK... but I agree with your suspicion that this is better
done in insetlayout parsing.
 
>  Abdel.

- Martin



Re: Todays 1.6svn crash in various ways when opening existing documents

2007-11-02 Thread Abdelrazak Younes

Martin Vermeer wrote:

On Sat, Nov 03, 2007 at 12:00:42AM +0100, Abdelrazak Younes wrote:

...

I fought with this fruitlessly until Jean-Marc showed me. You
reverted to my old non-working code :-(
 Calm down, I found a better solution (appended below, I guess you cannot 
 read lyx-cvs?).


Yes, but I didn't notice until later. Looks like you got it
working again (?)


Yes.


but the thingy in Text3.cpp doesn't look
pretty.


Really? In any case, I don't think we need to set the layout. Why not 
just accessing it through Inset::getLayout() when we need it? This will 
avoid an unnecessary copy and get rid of the layout_ member altogether.




Also, you shouldn't modify layout_ from within the inset. (can this be 
enforced by const?).

 We can do that yes.


Would be a good thing.


Or see above.



Can you not simply fully realize the labelfont (or a  local
copy) before using it in dimensionCollapsed()? A minimal fix.
 I fixed it by realizing it at setLayout() time. It works fine now but some 
 insets don't have entry in stdinsets.inc.


OK... but I agree with your suspicion that this is better
done in insetlayout parsing.


I'll do that.

Abdel.



Re: Todays 1.6svn crash in various ways when opening existing documents

2007-11-02 Thread Uwe Stöhr

> During a fast-evolving period like this, with no public release in
> between, reversion of lyx2lyx is IMHO acceptable.

But this introduces crashed: I can for example not open Stefan's macro example file, see my just 
sent post on the list.


Besides this we have the general problem that LyX can crash when a file is not in the right format. 
This definitively should not happen; no matter what format the file is, LyX should display an error 
message that the file is broken or whatever, but not crash.
This could be done when LyX is using a try .. finally routine in the file open code. I'm not 
experienced how this is done in C++, but something should be done in this field.


regards uwe


Re: Todays 1.6svn crash in various ways when opening existing documents

2007-11-02 Thread Bo Peng
> But this introduces crashed: I can for example not open Stefan's macro 
> example file, see my just
> sent post on the list.

As far as I know, today's crash is caused by some insets, not \begin manifest.

Bo