Uploaded image for project: 'Thrift'
  1. Thrift
  2. THRIFT-5678

TConnectedClient: warning due to non-virtual dtor

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 0.13.0, 0.14.0, 0.15.0, 0.14.1, 0.14.2, 0.16.0, 0.17.0
    • None
    • C++ - Library
    • None

    Description

      In TConnectedClient.h the destructor is non-virtual, which causes the warning below.

      In member function 'void apache::thrift::server::TServerFramework::disposeConnectedClient(apache::thrift::server::TConnectedClient*)':
      lib/cpp/src/thrift/server/TServerFramework.cpp:234:3: warning: deleting object of polymorphic class type 'apache::thrift::server::TConnectedClient' which has non-virtual destructor might cause undefined behavior [-Wdelete-non-virtual-dtor]
        234 |   delete pClient;
            |   ^~~~~~~~~~~~~~

      Not itself a major problem, but Zephyr CI promotes all warnings to errors, which causes builds to fail.

      TConnectedClient.cpp has the following line of code:

      TConnectedClient::~TConnectedClient() = default;

      It might be considered a regression. The commit that removed the virtual qualifier was 042580f53441efe1bc5c80c89351fcb30740659e

      Suggested fix is to mark it as virtual and set it to default in the header, and then delete the definition in the .cpp file.

      Alternatively, keep the .cpp dtor, but simply re-add the virtual keyword in the header

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              cfriedt Christopher Friedt
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 40m
                  40m