[geary/wip/765516-gtk-widget-conversation-viewer: 17/58] 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: 17/58] Add a workaround for web_view X allocation error.
- Date: Fri, 13 May 2016 02:17:48 +0000 (UTC)
commit c652963f5aedec6a173a2f7696c3cdae0837465a
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 61b84fb..edea133 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]