Skip to content

Commit f29a949

Browse files
committed
BlobGrid: Define virtual destructor in .cpp file
This fixes compiler warnings from clang: src/textord/blobgrid.h:33:7: warning: 'BlobGrid' 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 b3206d9 commit f29a949

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/textord/blobgrid.cpp

+5-1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ BlobGrid::BlobGrid(int gridsize, const ICOORD& bleft, const ICOORD& tright)
2525
: BBGrid<BLOBNBOX, BLOBNBOX_CLIST, BLOBNBOX_C_IT>(gridsize, bleft, tright) {
2626
}
2727

28+
// Destructor.
29+
// It is defined here, so the compiler can create a single vtable
30+
// instead of weak vtables in every compilation unit.
31+
BlobGrid::~BlobGrid() = default;
32+
2833
// Inserts all the blobs from the given list, with x and y spreading,
2934
// without removing from the source list, so ownership remains with the
3035
// source list.
@@ -37,5 +42,4 @@ void BlobGrid::InsertBlobList(BLOBNBOX_LIST* blobs) {
3742
}
3843
}
3944

40-
4145
} // namespace tesseract.

src/textord/blobgrid.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ using BlobGridSearch = GridSearch<BLOBNBOX, BLOBNBOX_CLIST, BLOBNBOX_C_IT>;
3333
class BlobGrid : public BBGrid<BLOBNBOX, BLOBNBOX_CLIST, BLOBNBOX_C_IT> {
3434
public:
3535
BlobGrid(int gridsize, const ICOORD& bleft, const ICOORD& tright);
36-
virtual ~BlobGrid() = default;
36+
virtual ~BlobGrid();
3737

3838
// Inserts all the blobs from the given list, with x and y spreading,
3939
// without removing from the source list, so ownership remains with the

0 commit comments

Comments
 (0)