[geary/wip/765516-gtk-widget-conversation-viewer: 64/107] Add a workaround for web_view X allocation error.
- From: Michael Gratton <mjog src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary/wip/765516-gtk-widget-conversation-viewer: 64/107] Add a workaround for web_view X allocation error.
- Date: Sun, 5 Jun 2016 12:32:52 +0000 (UTC)
commit 03d52e645c4eb6b1ef6973470955d590906759bc
Author: Michael James Gratton <mike vee net>
Date: Tue Apr 12 21:56:44 2016 +1000
Add a workaround for web_view X allocation error.
* src/client/conversation-viewer/conversation-web-view.vala
(ConversationWebView::get_preferred_height): Clamp reported preferred
height to something reasonable to avoid trying to allocate a stupidly
big pixmap.
.../conversation-viewer/conversation-web-view.vala | 13 +++++++++++++
1 files changed, 13 insertions(+), 0 deletions(-)
---
diff --git a/src/client/conversation-viewer/conversation-web-view.vala
b/src/client/conversation-viewer/conversation-web-view.vala
index 69bd762..a529422 100644
--- a/src/client/conversation-viewer/conversation-web-view.vala
+++ b/src/client/conversation-viewer/conversation-web-view.vala
@@ -68,6 +68,19 @@ public class ConversationWebView : StylishWebView {
if (load_status == WebKit.LoadStatus.FINISHED) {
preferred_height = (int) get_dom_document().get_body().offset_height;
}
+
+ // XXX Currently, for some messages the WebView will report
+ // very large offset heights, causing GDK and X allocation
+ // failures/warnings. If we get one, log it and limit it. A
+ // value of ~22000 was crashing my xserver with a WebView
+ // width of around 745.
+ const int MAX = 10000;
+ if (preferred_height > MAX) {
+ warning("WebView height reported as %i/%li, clamping",
+ preferred_height,
+ get_dom_document().get_body().offset_height);
+ preferred_height = MAX;
+ }
minimum_height = natural_height = preferred_height;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]