On Mon, Feb 19, 2007 at 01:20:02PM +0100, Georg Baum wrote: > This was found by gcc 3.2 (uninitialized variable warning). I wonder why > gcc 4.1 does not issue this warning. > > José, this is another candidate for the beta, since it is absolutely safe > and might even fix one of the caption bugs. > > > Georg
> Index: src/buffer_funcs.C > =================================================================== > --- src/buffer_funcs.C (Revision 17252) > +++ src/buffer_funcs.C (Arbeitskopie) > @@ -550,7 +550,7 @@ void setLabel(Buffer const & buf, ParIte > } else if (layout->labeltype == LABEL_SENSITIVE) { > // Search for the first float or wrap inset in the iterator > size_t i = it.depth(); > - InsetBase * in; > + InsetBase * in = 0; > while (i > 0) { > --i; > in = &it[i].inset(); > @@ -558,7 +558,9 @@ void setLabel(Buffer const & buf, ParIte > || in->lyxCode() == InsetBase::WRAP_CODE) > break; > } > - docstring const & type = in->getInsetName(); > + docstring type; > + if (in) > + type = in->getInsetName(); > > if (!type.empty()) { > Floating const & fl = > textclass.floats().getType(to_ascii(type)); Iterators should always have size() > 0 as there is always the outer text. I think we should assert instead of using 'if (in)' Andre'