On Wed, Feb 04, 2004 at 09:47:31AM +0000, Angus Leeming wrote: > Andre Poenitz wrote: > > This always returns 'true', so we can have 'void' instead and remove > > some never executed code... > > Hold on! These lfuns can be called from outside can't they? So it's > possible for a user to try and insert an inset in a layout that > doesn't allow it. Isn't this the reason for the > if (!insertInset(inset)) > delete inset; > ???
The code _always_ returned 'true', so this delete branch was never taken. It might well be that there was at some point of time the intention that insetInset could fail but it is clearly not in the code (and if it ever was, the removal was not my doing). > Maybe I've got this wrong, but I woudl have thought that the right > thing to do was make insertInset more intelligent (interrogate > whether such an inset were allowed in such a layout) rather than go > your way. May take is that a container (paragraph or math) has to stuff in whatever inset it gets passed once it was created. The 'control instance' that's there is LyXFunc::getStatus. Once something got past this and created an inset, the container is not guilty. Andre'