]> git.lyx.org Git - lyx.git/commit
Force a Buffer * argument to MathData constructor
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Wed, 24 Apr 2024 10:04:23 +0000 (12:04 +0200)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Fri, 5 Jul 2024 10:21:47 +0000 (12:21 +0200)
commit6b546613173e9b562c7d8648e798d5cfbb44eadb
tree02f1aac0dcf8f08505f6ff5ce7fffc5f085fbdf2
parent9bd91955557c151eec3447f112db681ed4dc518d
Force a Buffer * argument to MathData constructor

In order to ensure that MathData objects have a valid buffer, the
default MathData() constructor is deleted. This means that a buffer
shall be specified for each MathData object created.

This is fairly mechanical, actually. In particular, in most
InsetMathXxx cases, in MathData and in MathParser, the available
buffer_ member is used.

More specific cases:
- lyxfind.cpp takes the buffer from the Cursor

- calls to vector<MathData>::resize take an additional
  MathData(buffer_) parameter. There are cases where resize actually
  remove cells, and in this case clear() or even erase() have been
  used.

- in InsetMathMacroTemplate, the optional parameters of the
  constructors cannot be allowed anymore (a default value cannot
  depend on another parameter). Therefore there a now two constructors
  instead.

- in MathAutoCorrect.cpp, the MathData objects are not bound to a
  buffer, so that std::nullptr is used instead.

- in MathExtern, use a buffer when one is specified, std::nulptr
  instead.

(cherry picked from commit 57d713065545ac53a62a641d12a8b8c2c62c22fc)
16 files changed:
src/lyxfind.cpp
src/mathed/InsetMath.cpp
src/mathed/InsetMathGrid.cpp
src/mathed/InsetMathHull.cpp
src/mathed/InsetMathMacro.cpp
src/mathed/InsetMathMacroTemplate.cpp
src/mathed/InsetMathMacroTemplate.h
src/mathed/InsetMathNest.cpp
src/mathed/InsetMathRef.cpp
src/mathed/InsetMathScript.cpp
src/mathed/InsetMathSpace.cpp
src/mathed/MathAutoCorrect.cpp
src/mathed/MathData.cpp
src/mathed/MathData.h
src/mathed/MathExtern.cpp
src/mathed/MathParser.cpp