From 7d6a0f95063269b75007d0a21d7586e8a2010282 Mon Sep 17 00:00:00 2001 From: Jean-Marc Lasgouttes Date: Thu, 7 Dec 2000 15:30:53 +0000 Subject: [PATCH] Crash fix from Angus git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1269 a592a061-630c-0410-9148-cb99ea01b6c8 --- ChangeLog | 21 ++++++++++++++++----- src/CutAndPaste.C | 5 ++--- src/lyxparagraph.h | 6 ++++-- src/paragraph.C | 6 ++++-- src/tabular.C | 2 +- 5 files changed, 27 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2241fe98c6..dac8695a65 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2000-12-07 Angus Leeming + + * src/lyxparagraph.h, src/paragraph.C (CopyIntoMinibuffer): pass a + (Buffer const &), not a (BufferParams const &) and so fix a crash + caused by using current_view before it had been initialised. Not + the best way to do this, but much easier than changing + Inset::Clone(Buffer const &) to Inset::Clone(). + + * src/CutAndPaste.C: + * src/tabular.C: changed call to CopyIntoMinibuffer(). + 2000-12-07 Jean-Marc Lasgouttes * lib/ui/default.ui: put TOC at the beginning of the TOC menu. @@ -7,8 +18,8 @@ 2000-12-06 Angus Leeming - * src/frontends/xforms/FormPreferences.C (ScreenFonts::build): changed - filter for screen fonts input filter from int to float + * src/frontends/xforms/FormPreferences.C (ScreenFonts::build): + changed filter for screen fonts input filter from int to float * src/frontends/xforms/input_validators.c: removed. * src/frontends/xforms/input_validators.C: new file. Can now call C++ @@ -17,9 +28,9 @@ * src/frontends/xforms/input_validators.[Ch] (fl_unsigned_float_filter): new filter function. - * src/frontends/xforms/forms/fdfixc.sed: I defy gettext to get confused - now! And if you think I'm going to do this in ./forms/fdfix.sh with - its "sed -e" declarations, then think again! + * src/frontends/xforms/forms/fdfixc.sed: I defy gettext to get + confused now! And if you think I'm going to do this in + ./forms/fdfix.sh with its "sed -e" declarations, then think again! 2000-12-06 Lars Gullik Bjønnes diff --git a/src/CutAndPaste.C b/src/CutAndPaste.C index da51fb0ac6..ef04824c56 100644 --- a/src/CutAndPaste.C +++ b/src/CutAndPaste.C @@ -92,8 +92,7 @@ bool CutAndPaste::cutSelection(LyXParagraph * startpar, LyXParagraph ** endpar, if (end > startpar->Last()) end = startpar->Last(); for (; i < end; ++i) { - startpar->CopyIntoMinibuffer(current_view->buffer()->params, - start); + startpar->CopyIntoMinibuffer(*current_view->buffer(), start); startpar->Erase(start); buf->InsertFromMinibuffer(buf->Last()); @@ -188,7 +187,7 @@ bool CutAndPaste::copySelection(LyXParagraph * startpar, LyXParagraph * endpar, if (end > startpar->Last()) end = startpar->Last(); for (; i < end; ++i) { - startpar->CopyIntoMinibuffer(current_view->buffer()->params, i); + startpar->CopyIntoMinibuffer(*current_view->buffer(), i); buf->InsertFromMinibuffer(buf->Last()); } } else { diff --git a/src/lyxparagraph.h b/src/lyxparagraph.h index 6d8d612910..98e73a11ec 100644 --- a/src/lyxparagraph.h +++ b/src/lyxparagraph.h @@ -477,8 +477,10 @@ public: /// void CloseFootnote(size_type pos); #endif - /// important for cut and paste - void CopyIntoMinibuffer(BufferParams const &, size_type pos) const; + /** important for cut and paste + Temporary change from BufferParams to Buffer. Will revert when we + get rid of the argument to Inset::Clone(Buffer const &) */ + void CopyIntoMinibuffer(Buffer const &, size_type pos) const; /// void CutIntoMinibuffer(BufferParams const &, size_type pos); /// diff --git a/src/paragraph.C b/src/paragraph.C index bb4373347a..0360feceb7 100644 --- a/src/paragraph.C +++ b/src/paragraph.C @@ -407,15 +407,17 @@ void LyXParagraph::validate(LaTeXFeatures & features) const // First few functions needed for cut and paste and paragraph breaking. -void LyXParagraph::CopyIntoMinibuffer(BufferParams const & bparams, +void LyXParagraph::CopyIntoMinibuffer(Buffer const & buffer, LyXParagraph::size_type pos) const { + BufferParams bparams = buffer.params; + minibuffer_char = GetChar(pos); minibuffer_font = GetFontSettings(bparams, pos); minibuffer_inset = 0; if (minibuffer_char == LyXParagraph::META_INSET) { if (GetInset(pos)) { - minibuffer_inset = GetInset(pos)->Clone(*current_view->buffer()); + minibuffer_inset = GetInset(pos)->Clone(buffer); } else { minibuffer_inset = 0; minibuffer_char = ' '; diff --git a/src/tabular.C b/src/tabular.C index e417847a02..546ab310ef 100644 --- a/src/tabular.C +++ b/src/tabular.C @@ -1463,7 +1463,7 @@ void LyXTabular::OldFormatRead(LyXLex & lex, string const & fl) par->InsertChar(i, ' '); } } - par->CopyIntoMinibuffer(owner_->BufferOwner()->params, i); + par->CopyIntoMinibuffer(*owner_->BufferOwner(), i); inset->par->InsertFromMinibuffer(inset->par->Last()); } delete par;