Skip to content

Commit b3206d9

Browse files
committed
GridBase: Define virtual destructor in .cpp file
This fixes compiler warnings from clang: src/textord/bbgrid.h:53:7: warning: 'GridBase' has no out-of-line virtual method definitions; its vtable will be emitted in every translation unit [-Wweak-vtables] Signed-off-by: Stefan Weil <[email protected]>
1 parent 677198e commit b3206d9

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/textord/bbgrid.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ GridBase::GridBase(int gridsize, const ICOORD& bleft, const ICOORD& tright) {
3131
Init(gridsize, bleft, tright);
3232
}
3333

34+
// Destructor.
35+
// It is defined here, so the compiler can create a single vtable
36+
// instead of weak vtables in every compilation unit.
37+
GridBase::~GridBase() = default;
38+
3439
// (Re)Initialize the grid. The gridsize is the size in pixels of each cell,
3540
// and bleft, tright are the bounding box of everything to go in it.
3641
void GridBase::Init(int gridsize, const ICOORD& bleft, const ICOORD& tright) {

src/textord/bbgrid.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class GridBase {
5454
public:
5555
GridBase() = default;
5656
GridBase(int gridsize, const ICOORD& bleft, const ICOORD& tright);
57-
virtual ~GridBase() = default;
57+
virtual ~GridBase();
5858

5959
// (Re)Initialize the grid. The gridsize is the size in pixels of each cell,
6060
// and bleft, tright are the bounding box of everything to go in it.

0 commit comments

Comments
 (0)