Repository: kivy/kivy

Issue:
rows_sh_min throwing an exception "list index out of range" because its referencing the index meant for columns
<!--
The issue tracker is a tool to address bugs.
Please use the #kivy IRC channel on freenode or Stack Overflow for
support questions, more information at https://git.io/vM1yQ.

Before opening a new issue, make sure you do the following:
    * check that your issue isn't already filed: https://git.io/vM1iE
    * prepare a short, runnable example that reproduces the issue
    * reproduce the problem with the latest development version of Kivy
    * double-check that the issue is indeed a bug and not a support request
-->

### Versions

* Python: Python 3
* OS: Mac OS
* Kivy: 1.10.1.dev0
* Kivy installation method: cloned from github

### Description

I already know the problem, and I opened this ticket to follow the workflow for contributing fixes.

After running the kivy app in Android, the app crashes, giving a "list index out of range" exception.  After looking at the code, it appears the app is trying to reference a column index to pull from the list 'rows_sh_min'.
The source of the error is in gridlayout.py

I've already tested the fix on my end.

### Code and Logs

Android logcat
02-23 06:50:11.799  4670  4696 I python  :  Traceback (most recent call last):
02-23 06:50:11.800  4670  4696 I python  :    File "main.py", line 29, in <module>
02-23 06:50:11.802  4670  4696 I python  :      App_test().run()
02-23 06:50:11.802  4670  4696 I python  :    File "/data/user/0/org.test.myapptwo/files/app/crystax_python/site-packages/kivy/app.py", line 828, in run
02-23 06:50:11.806  4670  4696 I python  :      runTouchApp()
02-23 06:50:11.807  4670  4696 I python  :    File "/data/user/0/org.test.myapptwo/files/app/crystax_python/site-packages/kivy/base.py", line 504, in runTouchApp
02-23 06:50:11.809  4670  4696 I python  :      EventLoop.window.mainloop()
02-23 06:50:11.810  4670  4696 I python  :    File "/data/user/0/org.test.myapptwo/files/app/crystax_python/site-packages/kivy/core/window/window_sdl2.py", line 663, in mainloop
02-23 06:50:11.813  4670  4696 I python  :      self._mainloop()
02-23 06:50:11.813  4670  4696 I python  :    File "/data/user/0/org.test.myapptwo/files/app/crystax_python/site-packages/kivy/core/window/window_sdl2.py", line 405, in _mainloop
02-23 06:50:11.816  4670  4696 I python  :      EventLoop.idle()
02-23 06:50:11.816  4670  4696 I python  :    File "/data/user/0/org.test.myapptwo/files/app/crystax_python/site-packages/kivy/base.py", line 339, in idle
02-23 06:50:11.818  4670  4696 I python  :      Clock.tick()
02-23 06:50:11.819  4670  4696 I python  :    File "/data/user/0/org.test.myapptwo/files/app/crystax_python/site-packages/kivy/clock.py", line 581, in tick
02-23 06:50:11.823  4670  4696 I python  :      self._process_events()
02-23 06:50:11.824  4670  4696 I python  :    File "kivy/_clock.pyx", line 367, in kivy._clock.CyClockBase._process_events (kivy/_clock.c:7700)
02-23 06:50:11.825  4670  4696 I python  :    File "kivy/_clock.pyx", line 397, in kivy._clock.CyClockBase._process_events (kivy/_clock.c:7577)
02-23 06:50:11.826  4670  4696 I python  :    File "kivy/_clock.pyx", line 395, in kivy._clock.CyClockBase._process_events (kivy/_clock.c:7498)
02-23 06:50:11.827  4670  4696 I python  :    File "kivy/_clock.pyx", line 167, in kivy._clock.ClockEvent.tick (kivy/_clock.c:3490)
02-23 06:50:11.828  4670  4696 I python  :    File "/data/user/0/org.test.myapptwo/files/app/crystax_python/site-packages/kivy/uix/gridlayout.py", line 506, in do_layout
02-23 06:50:11.831  4670  4696 I python  :      self._fill_rows_cols_sizes()
02-23 06:50:11.831  4670  4696 I python  :    File "/data/user/0/org.test.myapptwo/files/app/crystax_python/site-packages/kivy/uix/gridlayout.py", line 360, in _fill_rows_cols_sizes
02-23 06:50:11.834  4670  4696 I python  :      rows_sh_min[col] = nmax(rows_sh_min[col], shh_min)
02-23 06:50:11.834  4670  4696 I python  :  IndexError: list index out of range



Discussion:
👋 Thanks for opening your first issue here! Be sure to follow the issue template!

Did you submit a fix for it? I don't see one. I'll merge it if you submit it (we just need to change col for row).

Resolving patch:
diff --git a/kivy/uix/gridlayout.py b/kivy/uix/gridlayout.py
--- a/kivy/uix/gridlayout.py
+++ b/kivy/uix/gridlayout.py
@@ -359,10 +359,10 @@ def _fill_rows_cols_sizes(self):
                 rows_sh[row] = nmax(rows_sh[row], shh)
                 if shh_min is not None:
                     has_bound_y = True
-                    rows_sh_min[col] = nmax(rows_sh_min[col], shh_min)
+                    rows_sh_min[row] = nmax(rows_sh_min[row], shh_min)
                 if shh_max is not None:
                     has_bound_y = True
-                    rows_sh_max[col] = nmin(rows_sh_max[col], shh_max)
+                    rows_sh_max[row] = nmin(rows_sh_max[row], shh_max)
         self._has_hint_bound_x = has_bound_x
         self._has_hint_bound_y = has_bound_y
 


Test patch: