D16278: [effects/presentwindows] avoid potential freeze during fill-gaps

Erik Kurzinger <[email protected]>
Newsgroups gmane.comp.kde.devel.kwin
Message-ID <[email protected]>
ekurzinger created this revision.
ekurzinger added reviewers: KWin, kwin, romangg.
ekurzinger added a project: KWin.
ekurzinger requested review of this revision.

REVISION SUMMARY
  When using the natural layout algorithm with the fill-gaps option, a small
  error (less than one) is introduced in windows' aspect ratio each time they are
  enlarged due to floating-point roundoff.
  
        
  
  Currently, the algorithm computes the width and height enlargement factors and
  then attempts to enlarge in each of the four possible directions, repeating
  until it can't enlarge any windows any further.  Hence, this aspect ratio error
  can be multiplied by up to four. Especially for small, long, and narrow
  windows, this can result in a total error of greater than one by the end of
  that loop iteration. If this occurs, on subsequent iterations the height
  enlargement factor might then be computed as negative violating some of the
  core assumptions of the algorithm and resulting in the loop iterating endlessly
  until one of the window dimensions overflows, freezing the program for up to
  several minutes.
  
  To fix this, the height enlargement factor should be re-computed based on the
  new width each time the window is enlarged, ensuring the error introduced in
  the aspect ratio never exceeds one.
  
  BUG: 364709
  BUG: 380865
  BUG: 368811
  
  FIXED-IN: 5.51

REPOSITORY
  R108 KWin

REVISION DETAIL
  https://phabricator.kde.org/D16278

AFFECTED FILES
  effects/presentwindows/presentwindows.cpp

To: ekurzinger, #kwin, kwin, romangg
Cc: mkulinski, ragreen, jackyalcine, Pitel, iodelay, bwowk, ZrenBot, lesliezhai, ali-mohamed, hardening, jensreuterberg, abetts, sebas, apol, mart
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.