Bug 544140 - [GTK3] Endless calls to Tree.rendererGetPreferredWidthProc after clicking on editable PropertySheetPage tree cell
Summary: [GTK3] Endless calls to Tree.rendererGetPreferredWidthProc after clicking on ...
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 4.11   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 4.11 M3   Edit
Assignee: Eric Williams CLA
QA Contact:
URL:
Whiteboard: RHT
Keywords: triaged
Depends on:
Blocks:
 
Reported: 2019-02-05 09:05 EST by Simeon Andreev CLA
Modified: 2019-02-19 09:28 EST (History)
3 users (show)

See Also:


Attachments
Snippet to reproduce the problem with. Run and observe endless calls to Tree.rendererGetPreferredWidthProc(). (4.08 KB, text/x-java)
2019-02-05 09:54 EST, Simeon Andreev CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Simeon Andreev CLA 2019-02-05 09:05:56 EST
See https://bugs.eclipse.org/bugs/show_bug.cgi?id=535978#c14

> We are trying a 4.11 integration build as a base for our product and our
> ARTs ran into a hang. Bisection lead to this commit:
> 
> https://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/
> ?id=71472c2bbf838e2b785684fd57f0b2db6f2651cd
> 
> If I revert this commit with current SWT master, the hang is gone.
> 
> I've attached a YourKit profile snapshot, I've attached YourKit for some
> time during the hang.
> 
> I'll try to reproduce the problem in a minimal snippet, then I'll open a
> ticket for it. Or should I re-open this one?

So far no luck in reproducing this outside of our product. We have a GEF based view, with some drawn canvas on the left and a property page on the right. Clicking on an editable cell in the property page opens an editor. From that point on we see endless calls to Tree.rendererGetPreferredWidthProc.

This results in an endless wait in a few of our ARTs, which wait on display events and jobs after clicking on a cell in order to edit it.
Comment 1 Simeon Andreev CLA 2019-02-05 09:10:33 EST
Hi Eric,

I'm struggling to reproduce the problem here, so far my SWT/JFace snippets don't ever run into even a single call to Tree.rendererGetPreferredWidthProc().

However I do see this called whenever I e.g. hover over Package Explorer elements, or the cells of a property page (e.g. the Properties View). Unfortunately I don't find any properties that I can edit in the Properties View.

I've not been able to use PropertySheet in a snippet (this is what our product uses, albeit somewhat customized), I'll probably need a few days just to understand how to use the underlying framework.

Any idea what causes Tree.rendererGetPreferredWidthProc() calls? Must I change some property on the SWT tree? I tried adding an image to the tree element to no avail.

Best regards and thanks,
Simeon
Comment 2 Eric Williams CLA 2019-02-05 09:14:37 EST
(In reply to Simeon Andreev from comment #1)
> Hi Eric,
> 
> I'm struggling to reproduce the problem here, so far my SWT/JFace snippets
> don't ever run into even a single call to
> Tree.rendererGetPreferredWidthProc().
> 
> However I do see this called whenever I e.g. hover over Package Explorer
> elements, or the cells of a property page (e.g. the Properties View).
> Unfortunately I don't find any properties that I can edit in the Properties
> View.
> 
> I've not been able to use PropertySheet in a snippet (this is what our
> product uses, albeit somewhat customized), I'll probably need a few days
> just to understand how to use the underlying framework.
> 
> Any idea what causes Tree.rendererGetPreferredWidthProc() calls? Must I
> change some property on the SWT tree? I tried adding an image to the tree
> element to no avail.
> 
> Best regards and thanks,
> Simeon

GetPreferredWidthProc() is a callback from GTK to query the natural width of a cell. You can probably trigger it using computeSize() on a custom drawn Tree/Table. Not sure if it gets called for a "regular" Tree/Table (i.e. not custom drawn) -- I'd have to dig into the code more.

(In reply to Simeon Andreev from comment #0)
> So far no luck in reproducing this outside of our product. We have a GEF
> based view, with some drawn canvas on the left and a property page on the
> right. Clicking on an editable cell in the property page opens an editor.
> From that point on we see endless calls to
> Tree.rendererGetPreferredWidthProc.

Where does this editor open up? Do you mean a tree/table editor? What happens if you remove the neighbouring Canvas?
Comment 3 Simeon Andreev CLA 2019-02-05 09:54:18 EST
Created attachment 277454 [details]
Snippet to reproduce the problem with. Run and observe endless calls to Tree.rendererGetPreferredWidthProc().

OK, looks like the call is caused by the usage of org.eclipse.jface.viewers.OwnerDrawLabelProvider.

With the attached snippet "TestTreeViewer.java" the problem is even worse than our own product, there is no interaction necessary to observe endless calls to Tree.rendererGetPreferredWidthProc(). So far not sure why.

Note that I've not adjusted the label provider to actually display the tree elements, that was not necessary to observe the problem.
Comment 4 Eric Williams CLA 2019-02-05 10:02:48 EST
Thanks for the snippet, I'll take a look.
Comment 5 Simeon Andreev CLA 2019-02-05 10:31:59 EST
Here is the precise change that the revert brings, which removes the endless calls:

diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java
index 8e8dd7009c..b5d2c00b52 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java    
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java    
@@ -1464,7 +1464,7 @@ void propagateDraw (long /*int*/ container, long /*int*/ cairo) {
                 * widgets still remaining -- usually only happens when scrolling with the mouse
                 * wheel. See bug 535978.
                 */
-               if (noChildDrawing != null) GTK.gtk_widget_queue_draw(handle);
+               //if (noChildDrawing != null) GTK.gtk_widget_queue_draw(handle);
        }
 }
Comment 6 Eric Williams CLA 2019-02-05 10:37:57 EST
(In reply to Simeon Andreev from comment #5)
> Here is the precise change that the revert brings, which removes the endless
> calls:
> 
> diff --git a/bundles/org.eclipse.swt/Eclipse
> SWT/gtk/org/eclipse/swt/widgets/Composite.java
> b/bundles/org.eclipse.swt/Eclipse
> SWT/gtk/org/eclipse/swt/widgets/Composite.java
> index 8e8dd7009c..b5d2c00b52 100644
> --- a/bundles/org.eclipse.swt/Eclipse
> SWT/gtk/org/eclipse/swt/widgets/Composite.java    
> +++ b/bundles/org.eclipse.swt/Eclipse
> SWT/gtk/org/eclipse/swt/widgets/Composite.java    
> @@ -1464,7 +1464,7 @@ void propagateDraw (long /*int*/ container, long
> /*int*/ cairo) {
>                  * widgets still remaining -- usually only happens when
> scrolling with the mouse
>                  * wheel. See bug 535978.
>                  */
> -               if (noChildDrawing != null)
> GTK.gtk_widget_queue_draw(handle);
> +               //if (noChildDrawing != null)
> GTK.gtk_widget_queue_draw(handle);
>         }
>  }

Thanks -- I'll look into this right now.
Comment 7 Andrey Loskutov CLA 2019-02-05 10:43:29 EST
(In reply to Eric Williams from comment #6)
> (In reply to Simeon Andreev from comment #5)
> > Here is the precise change that the revert brings, which removes the endless
> > calls:

Cool, thanks Simeon!
 
> Thanks -- I'll look into this right now.

Would be great to have patch in the next build :-)
Comment 8 Eclipse Genie CLA 2019-02-05 11:25:10 EST
New Gerrit change created: https://git.eclipse.org/r/136320
Comment 9 Eric Williams CLA 2019-02-05 11:30:35 EST
(In reply to Eclipse Genie from comment #8)
> New Gerrit change created: https://git.eclipse.org/r/136320

Simeon/Andrey, please look at this gerrit and confirm that it solves the problems on your end.
Comment 11 Eric Williams CLA 2019-02-05 13:30:56 EST
(In reply to Andrey Loskutov from comment #7)
> Would be great to have patch in the next build :-)

This type of quick turnaround is only possible with your and Simeon's quick and thorough investigation. :)



(In reply to Eclipse Genie from comment #10)
> Gerrit change https://git.eclipse.org/r/136320 was merged to [master].
> Commit:
> http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/
> ?id=1befbecaf4583e81f9dfab38ecc4517fbaf36373

In master now.
Comment 12 Simeon Andreev CLA 2019-02-06 02:24:55 EST
Thanks for the fix!
Comment 13 Eric Williams CLA 2019-02-19 09:28:31 EST
Verified in I20190219-0600.