Browse Source

demodadsb: Prevent unsafe copying of Aircraft

Explicitly delete the copy constructor and copy assignment operator for
Aircraft, which owns dynamically allocated QTableWidgetItem objects.

The implicitly generated copy operations could shallow-copy the item pointers,
leaving multiple Aircraft instances referring to the same objects and
potentially causing invalid ownership or double deletion.

Since Aircraft is not intended to be copied or assigned, prohibit both
operations at compile time, turning potential runtime errors into
compile-time errors.

cppcheck identified the missing copy constructor and assignment operator
with its noCopyConstructor and noOperatorEq warnings.

Signed-off-by: Robin Getz <rgetz503@gmail.com>
chirpmodem-v8.0.0
Robin Getz 1 month ago
parent
commit
5c1b7fe8ed
No known key found for this signature in database
GPG Key ID: 51C7231FFED0E060
  1. 2
      plugins/channelrx/demodadsb/adsbdemodgui.h

2
plugins/channelrx/demodadsb/adsbdemodgui.h

@ -489,6 +489,8 @@ struct Aircraft { @@ -489,6 +489,8 @@ struct Aircraft {
m_staticAirTempItem = new QTableWidgetItem();
m_humidityItem = new QTableWidgetItem();
}
Aircraft(const Aircraft&) = delete;
Aircraft& operator=(const Aircraft&) = delete;
QString getImage() const;
QString getText(const ADSBDemodSettings *settings, bool all=false) const;

Loading…
Cancel
Save