Commit 29d6051e authored by Davis King's avatar Davis King

Fixed a bug in the image_display widget. If you switched it between

images of a different size while any kind of zoom was in effect
it could cause a segmentation fault.
parent b5511d2c
......@@ -3228,9 +3228,16 @@ namespace dlib
// if the new image has a different size when compared to the previous image
// then we should readjust the total rectangle size.
if (new_img.nr() != img.nr() || new_img.nc() != img.nc())
set_total_rect_size(new_img.nc(), new_img.nr());
{
if (zoom_in_scale != 1)
set_total_rect_size(new_img.nc()*zoom_in_scale, new_img.nr()*zoom_in_scale);
else
set_total_rect_size(new_img.nc()/zoom_out_scale, new_img.nr()/zoom_out_scale);
}
else
{
parent.invalidate_rectangle(rect);
}
assign_image_scaled(img,new_img);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment