On Wed, Mar 19, 2003 at 02:41:52PM +0100, Jean-Marc Lasgouttes wrote:

> Thanks a lot.

I'm still building  this but ...

john


Index: status.13x
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/Attic/status.13x,v
retrieving revision 1.1.2.61
diff -u -p -r1.1.2.61 status.13x
--- status.13x  19 Mar 2003 13:20:47 -0000      1.1.2.61
+++ status.13x  19 Mar 2003 13:55:48 -0000
@@ -38,3 +38,4 @@ What's new
 
 ** Bug fixes
 
+- attempting to navigate to deleted text via the TOC dialog crashed (bug #913)
Index: src/ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/ChangeLog,v
retrieving revision 1.1021.2.8
diff -u -p -r1.1021.2.8 ChangeLog
--- src/ChangeLog       19 Mar 2003 13:20:47 -0000      1.1021.2.8
+++ src/ChangeLog       19 Mar 2003 13:56:10 -0000
@@ -1,3 +1,9 @@
+2003-03-19  John Levon  <[EMAIL PROTECTED]>
+
+       * toc.h:
+       * toc.C: store a par id not Paragraph * to avoid
+       TOC dialog crash on deleted par
+
 2003-03-17  Jean-Marc Lasgouttes  <[EMAIL PROTECTED]>
 
        * version.C.in: update for 1.3.1
Index: src/toc.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/toc.C,v
retrieving revision 1.15
diff -u -p -r1.15 toc.C
--- src/toc.C   21 Nov 2002 18:33:07 -0000      1.15
+++ src/toc.C   19 Mar 2003 13:56:11 -0000
@@ -46,7 +46,7 @@ string const TocItem::asString() const
 
 void TocItem::goTo(LyXView & lv_) const
 {
-       string const tmp = tostr(par->id());
+       string const tmp = tostr(id_);
        lv_.dispatch(FuncRequest(LFUN_GOTO_PARAGRAPH, tmp));
 }
 
@@ -54,7 +54,7 @@ void TocItem::goTo(LyXView & lv_) const
 int TocItem::action() const
 {
        return lyxaction.getPseudoAction(LFUN_GOTO_PARAGRAPH,
-                                        tostr(par->id()));
+                                        tostr(id_));
 }
 
 
@@ -90,7 +90,7 @@ TocList const getTocList(Buffer const * 
                    && labeltype <= LABEL_COUNTER_CHAPTER + buf->params.tocdepth) {
                                // insert this into the table of contents
                        const int depth = max(0, labeltype - textclass.maxcounter());
-                       TocItem const item(par, depth,
+                       TocItem const item(par->id(), depth,
                                           par->asString(buf, true));
                        toclist["TOC"].push_back(item);
                }
Index: src/toc.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/toc.h,v
retrieving revision 1.3
diff -u -p -r1.3 toc.h
--- src/toc.h   8 Nov 2002 01:08:27 -0000       1.3
+++ src/toc.h   19 Mar 2003 13:56:11 -0000
@@ -39,17 +39,17 @@ namespace toc
 
 ///
 struct TocItem {
-       TocItem(Paragraph const * p, int d, string const & s)
-               : par(p), depth(d), str(s) {}
+       TocItem(int par_id, int d, string const & s)
+               : id_(par_id), depth(d), str(s) {}
        ///
        string const asString() const;
        /// set cursor in LyXView to this TocItem
        void goTo(LyXView & lv_) const;
        /// the action corresponding to the goTo above
        int action() const;
-       ///
-       Paragraph const * par;
-       ///
+       /// Paragraph ID containing this item
+       int id_;
+       /// nesting depth
        int depth;
        ///
        string str;
@@ -73,21 +73,18 @@ void asciiTocList(string const &, Buffer
     by ControlToc::getContents() */
 string const getType(string const & cmdName);
 
-///
 inline
 bool operator==(TocItem const & a, TocItem const & b)
 {
-       return a.par == b.par && a.str == b.str;
+       return a.id_ == b.id_ && a.str == b.str;
        // No need to compare depth.
 }
 
 
-///
 inline
 bool operator!=(TocItem const & a, TocItem const & b)
 {
        return !(a == b);
-       // No need to compare depth.
 }
 
 
Index: src/insets/ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/ChangeLog,v
retrieving revision 1.552.2.2
diff -u -p -r1.552.2.2 ChangeLog
--- src/insets/ChangeLog        25 Feb 2003 13:42:49 -0000      1.552.2.2
+++ src/insets/ChangeLog        19 Mar 2003 13:56:23 -0000
@@ -1,3 +1,8 @@
+2003-03-19  John Levon  <[EMAIL PROTECTED]>
+
+       * insetfloat.C:
+       * insetwrap.C: ToCItem takes par id not par
+
 2003-02-25  John Levon  <[EMAIL PROTECTED]>
 
        * insetgraphicsParams.h:
Index: src/insets/insetfloat.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insetfloat.C,v
retrieving revision 1.56
diff -u -p -r1.56 insetfloat.C
--- src/insets/insetfloat.C     8 Dec 2002 22:33:55 -0000       1.56
+++ src/insets/insetfloat.C     19 Mar 2003 13:56:24 -0000
@@ -352,7 +352,7 @@ void InsetFloat::addToToc(toc::TocList &
                        string const str =
                                tostr(toclist[name].size() + 1)
                                + ". " + tmp->asString(buf, false);
-                       toc::TocItem const item(tmp, 0 , str);
+                       toc::TocItem const item(tmp->id(), 0 , str);
                        toclist[name].push_back(item);
                }
        }
Index: src/insets/insetwrap.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insetwrap.C,v
retrieving revision 1.5
diff -u -p -r1.5 insetwrap.C
--- src/insets/insetwrap.C      8 Dec 2002 22:33:55 -0000       1.5
+++ src/insets/insetwrap.C      19 Mar 2003 13:56:24 -0000
@@ -264,7 +264,7 @@ void InsetWrap::addToToc(toc::TocList & 
                        string const str =
                                tostr(toclist[name].size() + 1)
                                + ". " + tmp->asString(buf, false);
-                       toc::TocItem const item(tmp, 0 , str);
+                       toc::TocItem const item(tmp->id(), 0 , str);
                        toclist[name].push_back(item);
                }
                tmp = tmp->next();

Reply via email to