Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIan Pun2016-07-28 16:46:15 -0400
committerEric Williams2016-07-29 11:30:38 -0400
commit5ac29feccec0adc013fc1efe58c955fffa22ad16 (patch)
tree67979f7d191bb69904c32d709c8f600d31b2d34f
parent7a85190cd50667abdba5e2c750a98f54b33545ce (diff)
downloadeclipse.platform.swt-5ac29feccec0adc013fc1efe58c955fffa22ad16.tar.gz
eclipse.platform.swt-5ac29feccec0adc013fc1efe58c955fffa22ad16.tar.xz
eclipse.platform.swt-5ac29feccec0adc013fc1efe58c955fffa22ad16.zip
Bug 498165 - [GTK3] Stackoverflow using MeasureItem listenerI20160731-2000
gtk_tree_view_column_cell_get_position() method is signalling into the redererGetPreferredWidthCallback everytime it is run, causing a recursive loop when MeasuredEvent has a listener in GTK3. I've disabled and reinanbled the callback when calling gtk_tree_view_column_cell_get_position() to fix this issue. Tested on GTK3.14 -> GTK3.21+ and GTK2 Change-Id: I7a70bf73df3123414c59b1b1aae2cd8af96db4be Signed-off-by: Ian Pun <ipun@redhat.com>
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TreeItem.java26
1 files changed, 24 insertions, 2 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TreeItem.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TreeItem.java
index 3c3e80e5be..518df2a8fb 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TreeItem.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TreeItem.java
@@ -743,7 +743,18 @@ Rectangle getImageBoundsInPixels (int index) {
* use the same underlying GTK structure.
*/
int [] x = new int [1], w = new int [1];
- OS.gtk_tree_view_column_cell_get_position (column, pixbufRenderer, x, w);
+ /*
+ * Bug 498165: gtk_tree_view_column_cell_get_position() sets off rendererGetPreferredWidthCallback in GTK3 which is an issue
+ * if there is an ongoing MeasureEvent listener. Disabling it and re-enabling the callback after the method is called
+ * prevents a stack overflow from occurring.
+ */
+ if (OS.GTK3) {
+ Callback.setEnabled(false);
+ OS.gtk_tree_view_column_cell_get_position (column, pixbufRenderer, x, w);
+ Callback.setEnabled(true);
+ } else {
+ OS.gtk_tree_view_column_cell_get_position (column, pixbufRenderer, x, w);
+ }
if (OS.GTK3) {
if (parent.pixbufSizeSet) {
if (x [0] > 0) {
@@ -758,7 +769,18 @@ Rectangle getImageBoundsInPixels (int index) {
long /*int*/ textRenderer = parent.getTextRenderer (column);
if (textRenderer == 0) return new Rectangle (0, 0, 0, 0);
int [] xText = new int [1], wText = new int [1];
- OS.gtk_tree_view_column_cell_get_position (column, textRenderer, xText, wText);
+ /*
+ * Bug 498165: gtk_tree_view_column_cell_get_position() sets off rendererGetPreferredWidthCallback in GTK3 which is an issue
+ * if there is an ongoing MeasureEvent listener. Disabling it and re-enabling the callback after the method is called
+ * prevents a stack overflow from occurring.
+ */
+ if (OS.GTK3) {
+ Callback.setEnabled(false);
+ OS.gtk_tree_view_column_cell_get_position (column, textRenderer, xText, wText);
+ Callback.setEnabled(true);
+ } else {
+ OS.gtk_tree_view_column_cell_get_position (column, textRenderer, xText, wText);
+ }
rect.x += xText [0];
}
} else {

Back to the top