Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package kio for openSUSE:Factory checked in 
at 2021-05-08 22:07:14
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/kio (Old)
 and      /work/SRC/openSUSE:Factory/.kio.new.2988 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "kio"

Sat May  8 22:07:14 2021 rev:109 rq:890943 version:5.81.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/kio/kio.changes  2021-04-12 12:36:30.173308316 
+0200
+++ /work/SRC/openSUSE:Factory/.kio.new.2988/kio.changes        2021-05-08 
22:07:15.685783163 +0200
@@ -1,0 +2,6 @@
+Tue May  4 20:28:31 UTC 2021 - Fabian Vogt <fab...@ritter-vogt.de>
+
+- Add patch to fix thumnail creation in certain conditions (kde#430862):
+  * 0001-PreviewJob-Create-a-larger-SHM-when-necessary.patch
+
+-------------------------------------------------------------------

New:
----
  0001-PreviewJob-Create-a-larger-SHM-when-necessary.patch

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ kio.spec ++++++
--- /var/tmp/diff_new_pack.u8FmkT/_old  2021-05-08 22:07:16.225780825 +0200
+++ /var/tmp/diff_new_pack.u8FmkT/_new  2021-05-08 22:07:16.229780807 +0200
@@ -37,6 +37,8 @@
 Source99:       baselibs.conf
 # PATCH-FIX-OPENSUSE kio_help-fallback-to-kde4-docs.patch -- allow kio_help to 
see into kde4 documentation, needed especially for khelpcenter5
 Patch0:         kio_help-fallback-to-kde4-docs.patch
+# PATCH-FIX-UPSTREAM
+Patch1:         0001-PreviewJob-Create-a-larger-SHM-when-necessary.patch
 BuildRequires:  extra-cmake-modules >= %{_kf5_bugfix_version}
 BuildRequires:  fdupes
 BuildRequires:  kf5-filesystem

++++++ 0001-PreviewJob-Create-a-larger-SHM-when-necessary.patch ++++++
>From bc02b2528c97eab0961b3ad608a4914d3ce4b46c Mon Sep 17 00:00:00 2001
From: Fabian Vogt <fab...@ritter-vogt.de>
Date: Tue, 4 May 2021 22:22:53 +0200
Subject: [PATCH] PreviewJob: Create a larger SHM when necessary

It's possible that during the lifetime of a PreviewJob thumbnails with
different sizes are created. The SHM was created to match the size of the first
(non-empty) thumbnail, so any larger ones after that would reuse the SHM with
insufficient size.

BUG: 430862
---
 src/widgets/previewjob.cpp | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/src/widgets/previewjob.cpp b/src/widgets/previewjob.cpp
index d30f71cf..4f71c1c7 100644
--- a/src/widgets/previewjob.cpp
+++ b/src/widgets/previewjob.cpp
@@ -136,6 +136,8 @@ public:
     int shmid;
     // And the data area
     uchar *shmaddr;
+    // Size of the shm segment
+    size_t shmsize;
     // Root of thumbnail cache
     QString thumbRoot;
     // List of encrypted mount points for checking if we should save thumbnail
@@ -733,17 +735,19 @@ void PreviewJobPrivate::createThumbnail(const QString 
&pixPath)
     }
 
 #if WITH_SHM
-    if (shmid == -1) {
+    size_t requiredSize = thumb_width * devicePixelRatio * thumb_height * 
devicePixelRatio * 4;
+    if (shmid == -1 || shmsize < requiredSize) {
         if (shmaddr) {
             // clean previous shared memory segment
             shmdt((char *)shmaddr);
-            shmctl(shmid, IPC_RMID, nullptr);
             shmaddr = nullptr;
+            shmctl(shmid, IPC_RMID, nullptr);
+            shmid = -1;
         }
-        auto size = thumb_width * thumb_height;
-        if (size > 0) {
-            shmid = shmget(IPC_PRIVATE, size * 4 * devicePixelRatio * 
devicePixelRatio, IPC_CREAT | 0600);
+        if (requiredSize > 0) {
+            shmid = shmget(IPC_PRIVATE, requiredSize, IPC_CREAT | 0600);
             if (shmid != -1) {
+                shmsize = requiredSize;
                 shmaddr = (uchar *)(shmat(shmid, nullptr, SHM_RDONLY));
                 if (shmaddr == (uchar *)-1) {
                     shmctl(shmid, IPC_RMID, nullptr);
-- 
2.25.1

Reply via email to