app: fix handling of guides and sample points in gimpimage-resize.c

Don't iterate the lists with for() because the loops can remove items,
which makes us say g_list_next() on a removed list item. Instead, use
while() and get the next item before possibly removing the current
one.

(cherry picked from commit 99ccf7223b1aafdc7bc07b37eb8497ccc2912dab)