Main window: Fix weird exception

Signed-off-by: Jerome Flesch <jflesch@gmail.com>
Main window: When the thumbnails of a page has been generated, reselect it if necessary

Signed-off-by: Jerome Flesch <jflesch@gmail.com>