3 Commits

Author SHA1 Message Date
Gavin MacGregor
42176f2fc0 Tag version 0.7.1-beta 2025-02-11 10:20:34 +00:00
Gavin MacGregor
b937102139 Fix crash when copy constructing unhandled packets
Actually this is a workaround: it does not attempt to copy construct
unhandled packets, to avoid a bug in the base class where pointers were
copy constructed without copying the contents.

A proper fix will need refactoring of the packet storage code.
2025-02-11 09:43:36 +00:00
Gavin MacGregor
df1122f621 Fix clang compile warnings 2025-01-19 19:22:09 +00:00
6 changed files with 17 additions and 10 deletions

View File

@@ -33,6 +33,7 @@ LevelOnePage::LevelOnePage()
clearPage();
}
// BUG this copy constructor isn't used? Parameter should be LevelOnePage
LevelOnePage::LevelOnePage(const PageBase &other)
{
m_enhancements.reserve(maxEnhancements());
@@ -186,7 +187,9 @@ bool LevelOnePage::setPacket(int packetNumber, QByteArray packetContents)
}
qDebug("LevelOnePage unhandled setPacket X/%d", packetNumber);
return PageBase::setPacket(packetNumber, packetContents);
// BUG can't store unhandled packets as default copy constructor uses pointers
//return PageBase::setPacket(packetNumber, packetContents);
return false;
}
bool LevelOnePage::setPacket(int packetNumber, int designationCode, QByteArray packetContents)
@@ -253,7 +256,9 @@ bool LevelOnePage::setPacket(int packetNumber, int designationCode, QByteArray p
}
qDebug("LevelOnePage unhandled setPacket X/%d/%d", packetNumber, designationCode);
return PageBase::setPacket(packetNumber, designationCode, packetContents);
// BUG can't store unhandled packets as default copy constructor uses pointers
//return PageBase::setPacket(packetNumber, designationCode, packetContents);
return false;
}
bool LevelOnePage::packetExists(int packetNumber) const

View File

@@ -36,6 +36,7 @@ public:
enum CycleTypeEnum { CTcycles, CTseconds };
LevelOnePage();
// BUG this copy constructor isn't used? Parameter should be LevelOnePage
LevelOnePage(const PageBase &other);
bool isEmpty() const override;
@@ -52,7 +53,7 @@ public:
void clearPage();
int maxEnhancements() const { return 208; };
int maxEnhancements() const override { return 208; };
/* void setSubPageNumber(int); */
int cycleValue() const { return m_cycleValue; };

View File

@@ -30,7 +30,7 @@ int main(int argc, char *argv[])
QApplication::setApplicationDisplayName(QApplication::applicationName());
QApplication::setOrganizationName("gkmac.co.uk");
QApplication::setOrganizationDomain("gkmac.co.uk");
QApplication::setApplicationVersion("0.7-beta");
QApplication::setApplicationVersion("0.7.1-beta");
QCommandLineParser parser;
parser.setApplicationDescription(QApplication::applicationName());
parser.addHelpOption();

View File

@@ -52,7 +52,7 @@ public:
QSize sizeHint() { return QSize(480+(pageDecode()->leftSidePanelColumns()+pageDecode()->rightSidePanelColumns())*12, 250); }
void inputMethodEvent(QInputMethodEvent *event);
void inputMethodEvent(QInputMethodEvent *event) override;
TeletextDocument* document() const { return m_teletextDocument; }
TeletextPageDecode *pageDecode() { return &m_pageDecode; }

View File

@@ -264,7 +264,7 @@ void MainWindow::exportImage()
QImage scaledImage[6];
for (int p=0; p<6; p++)
if (!interImage[p].isNull())
if (!interImage[p].isNull()) {
if (m_viewAspectRatio == 3)
// Aspect ratio is Pixel 1:2 so we only need to double the vertical height
scaledImage[p] = interImage[p].scaled(interImage[p].width(), interImage[p].height()*2, Qt::IgnoreAspectRatio, Qt::FastTransformation);
@@ -276,6 +276,7 @@ void MainWindow::exportImage()
// Don't smooth GIF as it's bound to break the 256 colour limit
scaledImage[p] = doubleHeightImage.scaled((int)((float)doubleHeightImage.width() * aspectRatioHorizontalScaling[m_viewAspectRatio] * 2), doubleHeightImage.height(), Qt::IgnoreAspectRatio, (suffix == "gif") ? Qt::FastTransformation : Qt::SmoothTransformation);
}
}
if (suffix == "png") {
if (scaledImage[0].save(exportFileName, "PNG"))

View File

@@ -35,11 +35,11 @@ public:
int rowCount(const QModelIndex &parent = QModelIndex()) const override ;
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
bool setData(const QModelIndex &index, const QVariant &value, int role);
QVariant headerData(int section, Qt::Orientation orientation, int role) const;
bool insertRows(int position, int rows, const QModelIndex &parent);
bool setData(const QModelIndex &index, const QVariant &value, int role) override;
QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
bool insertRows(int position, int rows, const QModelIndex &parent) override;
bool insertRows(int position, int rows, const QModelIndex &parent, X26Triplet triplet);
bool removeRows(int position, int rows, const QModelIndex &index);
bool removeRows(int position, int rows, const QModelIndex &index) override;
// Qt::ItemFlags flags(const QModelIndex &index) const;
// The x26commands classes manipulate the model but beginInsertRows and endInsertRows