Skip to content
Commit 3c5acc66 authored by Halla Rempt's avatar Halla Rempt
Browse files

Handle the situation where the ng iterators get an empty stretch

Assert in developer mode so we know where to add the check for emptiness
before creating the iterator; make the iterator check at least a pixel
in release mode.

We cannot re-instate the old isDone() api because that would impair
performance too much:

13:26:45 < boud> CyrilleB: do you remember why the NG iterators don't have an isDone() check so the loop always checks at least once? (with do {} while
                 (it-NextPixel())
13:45:34 < CyrilleB> boud: performance
13:46:13 < CyrilleB> boud: especially since in 99.99% of the case, one does have something to iterate over
13:50:34 < boud> aah
13:50:49 < boud> because it's the reason of the crash in KisSelection::invert
13:52:29 < boud> maybe if the rect is empty we should make it have a width/height of one so there's always one pixel read in all cases
13:53:04 < CyrilleB> or rather have an assert if you try to create an iterator with a null width/height
13:53:20 < CyrilleB> (or both, if you want to ensure good behaviour for users)
                    it goes wrong
13:53:35 < CyrilleB> s/good behaviour/non crashing behaviour/
parent 2393ed18
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment