diff -Nru kylin-photo-viewer-1.3.0.3/debian/changelog kylin-photo-viewer-1.3.0.3/debian/changelog --- kylin-photo-viewer-1.3.0.3/debian/changelog 2024-02-21 09:56:33.000000000 +0800 +++ kylin-photo-viewer-1.3.0.3/debian/changelog 2025-01-13 16:48:07.000000000 +0800 @@ -1,3 +1,30 @@ +kylin-photo-viewer (1.3.0.3-ok20.4) yangtze; urgency=medium + + * BUG号:#IBH0OI 【看图】CNVD-C-2024-946320漏洞验证通报 + * 需求号:无 + * 其他改动说明:无 + * 影响域:无 + + -- sufang <sufang@kylinos.cn> Mon, 13 Jan 2025 16:48:07 +0800 + +kylin-photo-viewer (1.3.0.3-ok20.3) yangtze; urgency=medium + + * BUG号:#239870 KVE-2024-0701 + * 需求号:无 + * 其他改动说明:无 + * 影响域:无 + + -- sufang <sufang@kylinos.cn> Mon, 05 Aug 2024 17:07:43 +0800 + +kylin-photo-viewer (1.3.0.3-ok20.2) yangtze; urgency=medium + + * BUG号:无 + * 需求号:无 + * 其他改动说明:更新多线程数据线程锁处理,用于保证线程稳定性 + * 影响域:无 + + -- shangxiaoyang <shangxiaoyang@kylinos.cn> Tue, 16 Apr 2024 09:47:42 +0800 + kylin-photo-viewer (1.3.0.3-ok20.1) yangtze; urgency=medium * BUG号:#I8C0V7 【wayland】【次要】【看图】关于窗口位置不固定 diff -Nru kylin-photo-viewer-1.3.0.3/debian/patches/0016-53.patch kylin-photo-viewer-1.3.0.3/debian/patches/0016-53.patch --- kylin-photo-viewer-1.3.0.3/debian/patches/0016-53.patch 1970-01-01 08:00:00.000000000 +0800 +++ kylin-photo-viewer-1.3.0.3/debian/patches/0016-53.patch 2025-01-13 16:48:07.000000000 +0800 @@ -0,0 +1,370 @@ +From: shangxiaoyang <shangxiaoyang@kylinos.cn> +Date: Tue, 16 Apr 2024 02:13:48 +0000 +Subject: =?utf-8?b?ITUzIOabtOaWsOWkmue6v+eoi+aVsOaNrue6v+eoi+mUgeWkhOeQhg==?= + =?utf-8?b?77yM55So5LqO5L+d6K+B57q/56iL56iz5a6a5oCnIE1lcmdlIHB1bGwgcmVxdWVz?= + =?utf-8?b?dCAhNTMgZnJvbSBzaGFuZ3hpYW95YW5nL29wZW5reWxpbi95YW5ndHpl?= + +--- + codec/kylinimagecodec/image_load/image_load.cpp | 5 +++ + src/controller/core/coreinteraction.cpp | 11 ++++--- + src/controller/core/coreinteraction.h | 1 + + src/imageproviderthumb.cpp | 41 ++++++++++++++++++++----- + src/imageproviderthumb.h | 22 +++++-------- + src/main.cpp | 4 +++ + src/model/file/file.cpp | 11 +++++++ + src/view/showimagewidget.cpp | 6 ++-- + src/view/titlebar.cpp | 6 ++-- + 9 files changed, 77 insertions(+), 30 deletions(-) + +diff --git a/codec/kylinimagecodec/image_load/image_load.cpp b/codec/kylinimagecodec/image_load/image_load.cpp +index 896fe14..094bf75 100644 +--- a/codec/kylinimagecodec/image_load/image_load.cpp ++++ b/codec/kylinimagecodec/image_load/image_load.cpp +@@ -143,6 +143,11 @@ MatResult KylinImageCodec::loadMovieToMat(QString path, ImreadModes modes, QStri + mr.mat = mat; + return mr; + } ++ if (suffix == "png") { ++ mat = imread(path.toLocal8Bit().data(), modes).clone(); ++ mr.mat = mat; ++ return mr; ++ } + auto *tmpMovie = new QMovie(path, "apng"); + mr.maxFrame = tmpMovie->frameCount(); + tmpMovie->jumpToFrame(0); +diff --git a/src/controller/core/coreinteraction.cpp b/src/controller/core/coreinteraction.cpp +index f4b8cfb..57c5cbb 100644 +--- a/src/controller/core/coreinteraction.cpp ++++ b/src/controller/core/coreinteraction.cpp +@@ -19,7 +19,10 @@ CoreInteraction::CoreInteraction() + + CoreInteraction::~CoreInteraction() + { +- m_core->deleteLater(); ++ if(m_core) ++ m_core->deleteLater(); ++ if(m_thread) ++ m_thread->quit(); + } + + void CoreInteraction::creatCore(const QStringList &list) +@@ -30,12 +33,12 @@ void CoreInteraction::creatCore(const QStringList &list) + //开辟线程 + m_core = new Core(); + m_needStartWithOpenImagePath = m_core->initDbus(list); +- QThread *thread = new QThread(); ++ m_thread = new QThread(); + //绑定信号和槽 + initConnect(); + //放到新线程中 +- m_core->moveToThread(thread); +- thread->start(); ++ m_core->moveToThread(m_thread); ++ m_thread->start(); + m_isCoreInit = true; //防止多次初始化核心 + } + +diff --git a/src/controller/core/coreinteraction.h b/src/controller/core/coreinteraction.h +index 11ff3ba..e510dc6 100644 +--- a/src/controller/core/coreinteraction.h ++++ b/src/controller/core/coreinteraction.h +@@ -125,6 +125,7 @@ private: + QPointF m_naviPointFromQml = QPointF(-1, -1); + QSizeF m_displaySize = QSizeF(0, 0); + double m_imageScale = 0; ++ QThread *m_thread; + void dealEndPointNaviReact(); + }; + +diff --git a/src/imageproviderthumb.cpp b/src/imageproviderthumb.cpp +index 9e0e0dc..6a67dc7 100755 +--- a/src/imageproviderthumb.cpp ++++ b/src/imageproviderthumb.cpp +@@ -25,20 +25,38 @@ + //继承自QQuickImageProvider,与QQuickImageResponse结合起来使用,实现异步加载图片到qml + QQuickImageResponse *PQAsyncImageProviderThumb::requestImageResponse(const QString &url, const QSize &requestedSize) + { +- ScreenImageProvider *response = new ScreenImageProvider(url, requestedSize); ++ ScreenImageProvider *response = new ScreenImageProvider(url, requestedSize, m_mutex); + //开线程池 +- QThreadPool::globalInstance()->setMaxThreadCount(1); +- pool.start(response); ++ QThreadPool::globalInstance()->start(response); ++ + return response; + } + +-ScreenImageProvider::ScreenImageProvider(const QString &url, const QSize &requestedSize) +- : m_url(url), m_requestedSize(requestedSize) ++PQAsyncImageProviderThumb::PQAsyncImageProviderThumb(QMutex *mutex) ++ : m_mutex(mutex) ++{ ++ ++} ++PQAsyncImageProviderThumb::~PQAsyncImageProviderThumb() ++{ ++ // 可选:在析构时等待线程池中的任务完成 ++ QThreadPool::globalInstance()->waitForDone(); ++} ++ ++ ++ScreenImageProvider::ScreenImageProvider(const QString &url, const QSize &requestedSize, QMutex *mutex) ++ : m_url(url), m_requestedSize(requestedSize), m_mutex(mutex) + { + setAutoDelete(false); + } + +-ScreenImageProvider::~ScreenImageProvider() {} ++ScreenImageProvider::~ScreenImageProvider() { ++ if (isRunning) { ++ isRunning = false; ++ cancel(); ++ } ++ ++} + QQuickTextureFactory *ScreenImageProvider::textureFactory() const + { + return QQuickTextureFactory::textureFactoryForImage(m_image); +@@ -46,6 +64,7 @@ QQuickTextureFactory *ScreenImageProvider::textureFactory() const + + void ScreenImageProvider::run() + { ++ isRunning = true; + if (THEMEDARK == Variable::g_themeStyle || THEMEBLACK == Variable::g_themeStyle) { + m_image.load(Variable::DAMAGED_IMAGE_BLACK); + } else { +@@ -65,7 +84,11 @@ void ScreenImageProvider::run() + Q_EMIT finished(); + return; + } ++ ++ m_mutex->lock(); + QString realFormat = File::realFormat(m_url); ++ m_mutex->unlock(); ++ + //如果时多页tiff + if (realFormat == "tiff" || realFormat == "tif") { + if (Variable::imageHasLoaded(m_url + "0")) { +@@ -74,14 +97,18 @@ void ScreenImageProvider::run() + return; + } + } ++ m_mutex->lock(); + MatAndFileinfo maf = File::loadImage(m_url, realFormat); ++ m_mutex->unlock(); ++ + bool openSuccess = maf.openSuccess; //判断是否打开失败-损坏 + if (!openSuccess) { + Q_EMIT finished(); + return; + } ++ m_mutex->lock(); + QPixmap nowImage = Processing::converFormat(maf.mat); +- ++ m_mutex->unlock(); + + if (nowImage.isNull()) { + Q_EMIT finished(); +diff --git a/src/imageproviderthumb.h b/src/imageproviderthumb.h +index c5cab78..2fdbb77 100755 +--- a/src/imageproviderthumb.h ++++ b/src/imageproviderthumb.h +@@ -24,6 +24,7 @@ + + #include <QQuickAsyncImageProvider> + #include <QThreadPool> ++#include <QMutex> + #include <QPixmapCache> + #include <QMimeDatabase> + #include <QCryptographicHash> +@@ -39,16 +40,18 @@ class PQAsyncImageProviderThumb : public QQuickAsyncImageProvider + { + + public: ++ PQAsyncImageProviderThumb(QMutex *mutex); ++ ~PQAsyncImageProviderThumb(); + QQuickImageResponse *requestImageResponse(const QString &url, const QSize &requestedSize) override; + + private: +- QThreadPool pool; ++ QMutex *m_mutex; + }; + + class ScreenImageProvider : public QQuickImageResponse, public QRunnable + { + public: +- ScreenImageProvider(const QString &url, const QSize &requestedSize); ++ ScreenImageProvider(const QString &url, const QSize &requestedSize, QMutex *mutex); + ~ScreenImageProvider(); + + QQuickTextureFactory *textureFactory() const override; +@@ -58,19 +61,8 @@ public: + QString m_url; + QSize m_requestedSize; + QImage m_image; +- +- // ScreenImageProvider() : QQuickImageProvider(QQuickImageProvider::Image) {} +- +- // QImage requestImage(const QString &id, QSize *size, const QSize &requestedSize) +- // //这个是自动调用的。路径"image://screen",如需要使用id等参数,如"image://screen/id"等 +- // { +- +- // if (tempImage.isNull()) { +- // m_image.load("qrc:/res/res/damaged_img.png"); +- // } +- // return tempImage; +- // } +- // QImage m_image; ++ QMutex *m_mutex; ++ bool isRunning = false; + }; + + #endif // PQASYNCIMAGEPROVIDERTHUMB_H +diff --git a/src/main.cpp b/src/main.cpp +index 66971d8..09cce7b 100644 +--- a/src/main.cpp ++++ b/src/main.cpp +@@ -67,6 +67,10 @@ int main(int argc, char *argv[]) + } else { + a.installTranslator(&app_trans); + } ++ ++ // 设置线程池最大线程数 ++ QThreadPool::globalInstance()->setMaxThreadCount(QThread::idealThreadCount()); ++ + a.setApplicationName(QApplication::tr("Pictures")); + //主题框架 + KyView w(a.arguments()); +diff --git a/src/model/file/file.cpp b/src/model/file/file.cpp +index 2883905..02a4beb 100644 +--- a/src/model/file/file.cpp ++++ b/src/model/file/file.cpp +@@ -125,6 +125,7 @@ QString File::realFormat(const QString &path) + } else { + m_imageRealFormat = "jpeg"; + } ++ goto ends; + } + //{"bmp", "dib"}; + if (KylinImageCodec::g_bmpList.contains(m_imageRealFormat)) { +@@ -133,6 +134,7 @@ QString File::realFormat(const QString &path) + } else { + m_imageRealFormat = "bmp"; + } ++ goto ends; + } + //{"png", "apng"} + if (KylinImageCodec::g_pngList.contains(m_imageRealFormat)) { +@@ -141,6 +143,7 @@ QString File::realFormat(const QString &path) + } else { + m_imageRealFormat = "png"; + } ++ goto ends; + } + //{"fax", "g3"} + if (KylinImageCodec::g_faxList.contains(m_imageRealFormat)) { +@@ -149,6 +152,7 @@ QString File::realFormat(const QString &path) + } else { + m_imageRealFormat = "fax"; + } ++ goto ends; + } + //{"koa", "koala"} + if (KylinImageCodec::g_koaList.contains(m_imageRealFormat)) { +@@ -157,6 +161,7 @@ QString File::realFormat(const QString &path) + } else { + m_imageRealFormat = "koa"; + } ++ goto ends; + } + //{"lbm", "iff"} + if (KylinImageCodec::g_lbmList.contains(m_imageRealFormat)) { +@@ -165,6 +170,7 @@ QString File::realFormat(const QString &path) + } else { + m_imageRealFormat = "lbm"; + } ++ goto ends; + } + //{"tga", "targa"} + if (KylinImageCodec::g_tgaList.contains(m_imageRealFormat)) { +@@ -173,6 +179,7 @@ QString File::realFormat(const QString &path) + } else { + m_imageRealFormat = "tga"; + } ++ goto ends; + } + //{"tiff", "tif"} + if (KylinImageCodec::g_tiffList.contains(m_imageRealFormat)) { +@@ -181,6 +188,7 @@ QString File::realFormat(const QString &path) + } else { + m_imageRealFormat = "tiff"; + } ++ goto ends; + } + //{"pct", "pic", "pict"} + if (KylinImageCodec::g_pictList.contains(m_imageRealFormat)) { +@@ -189,6 +197,7 @@ QString File::realFormat(const QString &path) + } else { + m_imageRealFormat = "pict"; + } ++ goto ends; + } + //{"ppm", "pbm", "pgm"} + if (KylinImageCodec::g_pbmList.contains(m_imageRealFormat)) { +@@ -197,6 +206,7 @@ QString File::realFormat(const QString &path) + } else { + m_imageRealFormat = "pbm"; + } ++ goto ends; + } + if (KylinImageCodec::g_otherFormatList.contains(m_imageRealFormat)) { + if (KylinImageCodec::g_otherFormatList.contains(fileFormat) && fileFormat == m_imageRealFormat) { +@@ -205,6 +215,7 @@ QString File::realFormat(const QString &path) + } + } + ++ends: + return m_imageRealFormat; + } + +diff --git a/src/view/showimagewidget.cpp b/src/view/showimagewidget.cpp +index cb25248..dbb2a50 100644 +--- a/src/view/showimagewidget.cpp ++++ b/src/view/showimagewidget.cpp +@@ -62,7 +62,8 @@ ShowImageWidget::ShowImageWidget(QWidget *parent) : QWidget(parent) + + ShowImageWidget::~ShowImageWidget() + { +- delete m_imageMenu; ++ if (m_imageMenu) ++ delete m_imageMenu; + } + + void ShowImageWidget::initConnect() +@@ -1301,7 +1302,8 @@ void ShowImageWidget::initQmlObject() + //设置位置和大小 + m_showImageQml = new QQuickWidget(this); + QQmlEngine *engine = m_showImageQml->engine(); +- engine->addImageProvider(QLatin1String("thumb"), new PQAsyncImageProviderThumb); ++ QMutex *mutex = new QMutex(); ++ engine->addImageProvider(QLatin1String("thumb"), new PQAsyncImageProviderThumb(mutex)); + engine->addImageProvider(QLatin1String("main"), new ImageProvider); + qmlRegisterType<InteractiveQml>("Interactive", 1, 0, "Interactive"); + // qmlRegisterSingletonType<InteractiveQml>("InteractiveQml", 1, 0, "interactiveQml", +diff --git a/src/view/titlebar.cpp b/src/view/titlebar.cpp +index beb73b8..f612e14 100644 +--- a/src/view/titlebar.cpp ++++ b/src/view/titlebar.cpp +@@ -73,8 +73,10 @@ TitleBar::TitleBar(QWidget *parent) : QWidget(parent) + + TitleBar::~TitleBar() + { +- delete m_backButton; +- m_backButton = nullptr; ++ if(m_backButton) { ++ delete m_backButton; ++ m_backButton = nullptr; ++ } + } + //顶栏图片名字 + void TitleBar::showImageName(QString name, QString imagePath) diff -Nru kylin-photo-viewer-1.3.0.3/debian/patches/0017-133-fix-bug-239870.patch kylin-photo-viewer-1.3.0.3/debian/patches/0017-133-fix-bug-239870.patch --- kylin-photo-viewer-1.3.0.3/debian/patches/0017-133-fix-bug-239870.patch 1970-01-01 08:00:00.000000000 +0800 +++ kylin-photo-viewer-1.3.0.3/debian/patches/0017-133-fix-bug-239870.patch 2025-01-13 16:48:07.000000000 +0800 @@ -0,0 +1,52 @@ +From: =?utf-8?b?6IuP6Iqz?= <sufang@kylinos.cn> +Date: Tue, 6 Aug 2024 00:42:39 +0000 +Subject: =?utf-8?q?!133_fix_bug=3A239870_Merge_pull_request_!133_from_?= + =?utf-8?q?=E8=8B=8F=E8=8A=B3/openkylin/yangtze?= + +--- + codec/kylinimagecodec/image_load/image_load.cpp | 26 +++++++++++++++++++------ + 1 file changed, 20 insertions(+), 6 deletions(-) + +diff --git a/codec/kylinimagecodec/image_load/image_load.cpp b/codec/kylinimagecodec/image_load/image_load.cpp +index 094bf75..599a581 100644 +--- a/codec/kylinimagecodec/image_load/image_load.cpp ++++ b/codec/kylinimagecodec/image_load/image_load.cpp +@@ -250,18 +250,32 @@ Mat KylinImageCodec::loadFreeimageFormat(const char *filename) + Mat mat; + FIBITMAP *dib = NULL; + ++ QFileInfo fi(QString::fromUtf8(filename)); ++ QString suffix = fi.suffix(); ++ QString file_suffix_lower = suffix.toLower(); ++ QImageReader reader; ++ QImage res_qt; ++ ++ reader.setFileName(QString(filename)); ++ reader.setFormat(file_suffix_lower.toLatin1()); ++ reader.setAutoTransform(true); ++ ++ if(reader.imageCount() >= 0){ ++ res_qt = reader.read(); ++ if (res_qt.isNull()) { ++ qDebug()<<"获得图片格式失败或不支持此格式图片的读取"; ++ return mat; ++ } ++ } + /* 获取文件格式 */ + FREE_IMAGE_FORMAT fif = FIF_UNKNOWN; + fif = get_real_format(QString(filename)); + + if ((fif != FIF_UNKNOWN) && FreeImage_FIFSupportsReading(fif)) { + dib = FreeImage_Load(fif, filename, 0); +- } else { +- qDebug() << "获得图片格式失败或不支持此格式图片的读取"; +- } +- if (dib != NULL) { +- /* 将FIBITMAP转换成mat */ +- mat = FI2MAT(dib); ++ if (dib != NULL) { ++ mat = FI2MAT(dib); ++ } + FreeImage_Unload(dib); + } else { + qDebug() << "图像加载失败"; diff -Nru kylin-photo-viewer-1.3.0.3/debian/patches/0018-149-fix-issue-IBH0OI.patch kylin-photo-viewer-1.3.0.3/debian/patches/0018-149-fix-issue-IBH0OI.patch --- kylin-photo-viewer-1.3.0.3/debian/patches/0018-149-fix-issue-IBH0OI.patch 1970-01-01 08:00:00.000000000 +0800 +++ kylin-photo-viewer-1.3.0.3/debian/patches/0018-149-fix-issue-IBH0OI.patch 2025-01-13 16:48:07.000000000 +0800 @@ -0,0 +1,22 @@ +From: =?utf-8?b?6IuP6Iqz?= <sufang@kylinos.cn> +Date: Tue, 14 Jan 2025 05:43:13 +0000 +Subject: =?utf-8?q?!149_fix_issue=3A=23IBH0OI_Merge_pull_request_!149_from_?= + =?utf-8?q?=E8=8B=8F=E8=8A=B3/openkylin/yangtze?= + +--- + codec/kylinimagecodec/image_load/image_load.cpp | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/codec/kylinimagecodec/image_load/image_load.cpp b/codec/kylinimagecodec/image_load/image_load.cpp +index 599a581..13863ad 100644 +--- a/codec/kylinimagecodec/image_load/image_load.cpp ++++ b/codec/kylinimagecodec/image_load/image_load.cpp +@@ -94,6 +94,8 @@ MatResult KylinImageCodec::loadImageToMat(QString path, ImreadModes modes, QStri + mat = Mat(image.height(), image.width(), CV_8UC3, const_cast<uchar *>(image.bits()), + static_cast<size_t>(image.bytesPerLine())) + .clone(); ++ } else if (suffix == "jpeg") { ++ mat = imread(path.toLocal8Bit().data(), IMREAD_COLOR); + } else { + mat = loadFreeimageFormat(path.toLocal8Bit().data()); + } diff -Nru kylin-photo-viewer-1.3.0.3/debian/patches/series kylin-photo-viewer-1.3.0.3/debian/patches/series --- kylin-photo-viewer-1.3.0.3/debian/patches/series 2024-02-21 09:56:33.000000000 +0800 +++ kylin-photo-viewer-1.3.0.3/debian/patches/series 2025-01-13 16:48:07.000000000 +0800 @@ -13,3 +13,6 @@ 0013-.patch 0014-24-Fix-issues-I8BGMS-and-New-demand-21938.patch 0015-35-Fix-issues-I8C0V7-I8C0W0.patch +0016-53.patch +0017-133-fix-bug-239870.patch +0018-149-fix-issue-IBH0OI.patch