[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kolor-manager/kded] kolor-server: fix for regions without profile
From:       Kai-Uwe Behrmann <ku.b () gmx ! de>
Date:       2013-03-23 5:59:42
Message-ID: 20130323055942.4643AA603F () git ! kde ! org
[Download RAW message or body]

Git commit 58f19a7aaa0e906de6f4aeb6e1d030b87475a716 by Kai-Uwe Behrmann.
Committed on 23/03/2013 at 06:56.
Pushed by behrmann into branch 'kded'.

fix for regions without profile

screen.cpp avoid access to out of array indexes.

window.cpp Window::updateRegions()  adds a empty ColorContext to a region without ICC profile.

closes KDE Review Request #109392

M  +8    -2    kolor-server/screen.cpp
M  +4    -0    kolor-server/window.cpp

http://commits.kde.org/kolor-manager/58f19a7aaa0e906de6f4aeb6e1d030b87475a716

diff --git a/kolor-server/screen.cpp b/kolor-server/screen.cpp
index c6ac80a..40fec23 100644
--- a/kolor-server/screen.cpp
+++ b/kolor-server/screen.cpp
@@ -311,16 +311,22 @@ void Screen::updateWindowRegions(uint windowId)
 
     w->updateRegions(m_outputs);
 
+    kDebug() << "Windows to update: " << m_windows.size();
+
     // Recreate region clut list
     m_regionCluts.clear();
     for (int i = 0; i < m_windows.size(); ++i) {
         for (int i_region = 0; i_region < m_windows[i]->regionCount(); ++i_region) {
             RegionalClut rclut;
             rclut.region = m_windows[i]->region(i_region);
-            rclut.windowId = windowId;
+            rclut.windowId = m_windows[i]->id();
             for (int i_output = 0; i_output < m_outputs.size(); ++i_output) {
                 rclut.outputIndex = i_output;
-                rclut.clut = m_windows[i]->regionColorContext(i_region, i_output)->colorLookupTable();
+                ColorContext * cc =  m_windows[i]->regionColorContext(i_region, i_output);
+                if (cc)
+                    rclut.clut = cc->colorLookupTable();
+                else
+                    buildDummyClut(rclut.clut);
                 m_regionCluts.insert((uint) m_windows[i]->id(), rclut);
 
                 kDebug() << "Regional clut:" << "windowId:" << rclut.windowId <<
diff --git a/kolor-server/window.cpp b/kolor-server/window.cpp
index 4325273..003bd78 100644
--- a/kolor-server/window.cpp
+++ b/kolor-server/window.cpp
@@ -149,6 +149,10 @@ void Window::updateRegions(const QList<ColorOutput*> &outputs)
 
                 region.contexts.append(cc);
             }
+        } else {
+            for (int i_output = 0; i_output < outputs.size(); ++i_output) {
+                region.contexts.append(NULL);
+            }
         }
 
         m_regions.append(region);
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic