Skip to content

Issue #10372: Fix crash when pattern can't be loaded

Alx Sa requested to merge alxsa-pattern-crash-fix into gimp-2-10

This patch attempts to fix a mistake I made in 8af280b5.

In some instances (like making a small indexed selection), the pattern preview won't load successfully. Prior to 8af280b5 this was fine, because a default pattern would be displayed instead. However, 8af280b5 assumes the temp_buf is always loaded and scaled successfully. This can cause a crash if for example the pattern dockable is visible, as noted by the many reports.

I attempt to fix this by checking if the temp_buf is loaded before trying to get its GeglBuffer. If it isn't, the original default pattern code from before is run.

@Wormnest Hi! If and when you have time, does this look like a good solution to the problem?

Note: I also need to fix this in 2.99, but there seems to be better error-handling code elsewhere in the development version. I haven't yet been able to trigger the same problem we've observed in 2.10.36.

Merge request reports