MorganGrundy / MosaicMagnifique

Application for generating Photomosaics. Turn your images into beautiful Photomosaics.
https://morgangrundy.github.io
GNU General Public License v3.0
14 stars 0 forks source link

[BUG] Crash when changing cell size #18

Closed MorganGrundy closed 3 years ago

MorganGrundy commented 3 years ago

Describe the bug Sometimes the app crashes when changing the cell size.

To Reproduce Steps to reproduce the behavior:

  1. Load Hexagon cell shape
  2. Load main image from https://unsplash.com/photos/kTBJmeRbAbo
  3. Set detail to 50%
  4. Activate cell shape
  5. Decrement minimum cell size once
  6. Set cell size to 125
  7. App crashes

Expected behavior App should not crash and instead update the grid.

Context (Environment):

MorganGrundy commented 3 years ago

Changing any one of these settings avoids a crash, however there are other configurations that also cause a crash.

I originally thought the crash originated from the cell shape, but obviously that is not the case. Crash must be in either grid generation or grid preview update.

MorganGrundy commented 3 years ago

Crash occurs during grid generation. During GridGenerator::findCellState() with an edge cell, when the cell bounds are resized to detail cell bounds the width/height can become 0. Resulting in an empty mask and trying to resize the cell image to 0.

Also means there is a different problem in Photomosaic generation of a similar cause, although it wouldn't cause a crash.

MorganGrundy commented 3 years ago

Fixed: f324fa9d3599501e9e3d245207d506ec606bf8e2