Skip to content

Commit

Permalink
BlobGrid: Define virtual destructor in .cpp file
Browse files Browse the repository at this point in the history
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 <sw@weilnetz.de>
  • Loading branch information
stweil committed Sep 4, 2018
1 parent b3206d9 commit f29a949
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/textord/blobgrid.cpp
Expand Up @@ -25,6 +25,11 @@ BlobGrid::BlobGrid(int gridsize, const ICOORD& bleft, const ICOORD& tright)
: BBGrid<BLOBNBOX, BLOBNBOX_CLIST, BLOBNBOX_C_IT>(gridsize, bleft, tright) {
}

// Destructor.
// It is defined here, so the compiler can create a single vtable
// instead of weak vtables in every compilation unit.
BlobGrid::~BlobGrid() = default;

// Inserts all the blobs from the given list, with x and y spreading,
// without removing from the source list, so ownership remains with the
// source list.
Expand All @@ -37,5 +42,4 @@ void BlobGrid::InsertBlobList(BLOBNBOX_LIST* blobs) {
}
}


} // namespace tesseract.
2 changes: 1 addition & 1 deletion src/textord/blobgrid.h
Expand Up @@ -33,7 +33,7 @@ using BlobGridSearch = GridSearch<BLOBNBOX, BLOBNBOX_CLIST, BLOBNBOX_C_IT>;
class BlobGrid : public BBGrid<BLOBNBOX, BLOBNBOX_CLIST, BLOBNBOX_C_IT> {
public:
BlobGrid(int gridsize, const ICOORD& bleft, const ICOORD& tright);
virtual ~BlobGrid() = default;
virtual ~BlobGrid();

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

0 comments on commit f29a949

Please sign in to comment.