Clamp ConversationWebView height again to avoid crashes displaying large images.
This commit is contained in:
parent
3e203a9c19
commit
c1ceaa9868
1 changed files with 11 additions and 1 deletions
|
|
@ -85,7 +85,17 @@ public class ConversationWebView : ClientWebView {
|
|||
// doesn't seem to work.
|
||||
public override void get_preferred_height(out int minimum_height,
|
||||
out int natural_height) {
|
||||
minimum_height = natural_height = this.preferred_height;
|
||||
// XXX clamp height to something not too outrageous so we
|
||||
// don't get an XServer error trying to allocate a massive
|
||||
// window.
|
||||
const uint max_pixels = 8 * 1024 * 1024;
|
||||
int width = get_allocated_width();
|
||||
int height = this.preferred_height;
|
||||
if (height * width > max_pixels) {
|
||||
height = (int) Math.floor(max_pixels / (double) width);
|
||||
}
|
||||
|
||||
minimum_height = natural_height = height;
|
||||
}
|
||||
|
||||
// Overridden since we always what the view to be sized according
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue