Debugging a UI refresh problem (not dirtyopts related it seems)

John Hendrikx hjohn at xs4all.nl
Thu Jun 14 13:28:00 PDT 2012


I created a test case, that reproduces something similar... good chance 
it is related.

See http://javafx-jira.kenai.com/browse/RT-22555

--John

On 14/06/2012 21:48, John Hendrikx wrote:
>
> I seem to have narrowed it down to the call to scrollTo()...  when I 
> remove it, I cannot make it fail anymore.
>
> So, the case is:
>
> 1) StackPane with two children, one of them being another StackPane 
> that contains a TableView or TreeView (happens with either) -- the 
> Views contain several pages worth of data.
>
> A KeyEvent occurs, which triggers the following chain:
>
> 2a) Find the current selected item in said TableView/TreeView, and 
> make a note of it.
> 2b) Remove the StackPane with the View
> 2c) Add a new StackPane with a different View
> 2d) Reselect the item that was selected in the newly added View 
> (basically, the code switches between a TreeView and TableView)
>
> Step 2d) does not do the selection (+scrolling) of the previously 
> selected item in the same Event (as that has proven in the past to 
> cause numerous issues...).  As a work-around I found that it was 
> better to defer those calls by simply wrapping them in a 
> Platform.runLater()...
>
> So, after the KeyEvent fully completes, with maybe a few other events 
> in between, our Platform.runLater() code should run, which does the 
> actual selection (a focus() call) and the scrolling (a scrollTo() call).
>
> If I comment out the scrollTo(), it works flawlessly and the new 
> StackPane is always redrawn correctly (but obviously, not in the 
> correct scroll position)
>
> If I donot do the focus+scrollTo() in a Platform.runLater() then 
> basically that part of the code rarely functions properly at all (the 
> View classes simply donot seem to like it when you do these calls in 
> the same event that created them and made them part of the Scene, see 
> my comment in issue RT-18816)... despite that, the behaviour is 
> slightly different -- not the entire display disappears anymore, but 
> only the *View class is not drawn correctly (scrollbar visible, but 
> nothing else).
>
> So, it seems the problem is concentrated in the View classes, and 
> specifically how they deal with being created, filled, focused and 
> scroll'ed'To() in the same KeyEvent :)
>
> --John
>
> On 14/06/2012 20:38, John Hendrikx wrote:
>> Hi Richard,
>>
>> The verbose options works, below is the output, dirtyopts seems to be 
>> false (3rd line).
>>
>> I've noticed that it is definitely related to whether or not any 
>> "animation" action occurs after switching a Child of the StackPane... 
>> if there is any kind of action happening (like an image being loaded, 
>> or a scrollTo command triggering a slight bit of scrolling) then it 
>> redraws properly... and it was hard to reproduce it because of that.
>>
>> However, I've now noticed that when I go back and forth between the 
>> same screens, and the 2nd time I return to the same view (when all 
>> Images are cached and the UI can react even faster) then the chance 
>> of the bug happening is much much bigger (like 90%).  Apparently 
>> because no changes in layout or node values are occuring after the 
>> initial one... thus if the initial drawing was somehow missed, I end 
>> up with an empty screen until I do something that triggers a change.  
>> I'm not convinced that it might not be my fault somehow, but it 
>> doesn't occur in 2.1.
>>
>> So, it seems that under certain conditions, removing a child from a 
>> StackPane and replacing it with a similar child (which is practically 
>> static) results in it not being drawn.  I'll see if I can strip it 
>> down far enough to make it reproducable in a stand-alone program in 
>> the weekend -- it is easy enough to reproduce in the main program 
>> (not like my scroll wheel bug :))
>>
>> --John
>>
>>     0.065  | Prism pipeline init order: d3d 
>> j2d                                                                          
>> -- 
>> com.sun.prism.impl.PrismSettings.checkSettings(PrismSettings.java:216)
>>     0.066  | Using t2k for text 
>> rasterization                                                                            
>> -- 
>> com.sun.prism.impl.PrismSettings.checkSettings(PrismSettings.java:217)
>>     0.066  | Not using dirty region 
>> optimizations                                                                        
>> -- 
>> com.sun.prism.impl.PrismSettings.checkSettings(PrismSettings.java:221)
>>     0.066  | Prism pipeline name = 
>> com.sun.prism.d3d.D3DPipeline                                                         
>> -- 
>> com.sun.prism.GraphicsPipeline.createPipeline(GraphicsPipeline.java:148)
>>     0.067  | Loading D3D native library 
>> ...                                                                              
>> -- com.sun.prism.d3d.D3DPipeline$1.run(D3DPipeline.java:29)
>>     0.069  |     
>> succeeded.                                                                                                 
>> -- com.sun.prism.d3d.D3DPipeline$1.run(D3DPipeline.java:33)
>>     0.134  | Direct3D initialization 
>> succeeded                                                                           
>> -- com.sun.prism.d3d.D3DPipeline.<clinit>(D3DPipeline.java:40)
>>     0.136  | (X) Got class = class 
>> com.sun.prism.d3d.D3DPipeline                                                         
>> -- 
>> com.sun.prism.GraphicsPipeline.createPipeline(GraphicsPipeline.java:152)
>>     0.137  | Initialized prism pipeline: 
>> com.sun.prism.d3d.D3DPipeline                                                   
>> -- 
>> com.sun.prism.GraphicsPipeline.createPipeline(GraphicsPipeline.java:159)
>>     0.185  | OS 
>> Information:                                                                                             
>> -- 
>> com.sun.prism.d3d.D3DPipeline.printDriverInformation(D3DPipeline.java:87) 
>>
>>     0.185  |     Windows 7 build 
>> 7601                                                                                       
>> -- 
>> com.sun.prism.d3d.D3DPipeline.printDriverInformation(D3DPipeline.java:88) 
>>
>>     0.185  | D3D Driver 
>> Information:                                                                                     
>> -- 
>> com.sun.prism.d3d.D3DPipeline.printDriverInformation(D3DPipeline.java:89) 
>>
>>     0.185  |     NVIDIA GeForce GTX 550 
>> Ti                                                                                  
>> -- 
>> com.sun.prism.d3d.D3DPipeline.printDriverInformation(D3DPipeline.java:90) 
>>
>>     0.185  |     
>> \\.\DISPLAY3                                                                                               
>> -- 
>> com.sun.prism.d3d.D3DPipeline.printDriverInformation(D3DPipeline.java:91) 
>>
>>     0.186  |     Driver nvd3dum.dll, version 
>> 8.17.12.8562                                                                   
>> -- 
>> com.sun.prism.d3d.D3DPipeline.printDriverInformation(D3DPipeline.java:92) 
>>
>>     0.186  |     Pixel Shader version 
>> 3.0                                                                                   
>> -- 
>> com.sun.prism.d3d.D3DPipeline.printDriverInformation(D3DPipeline.java:93) 
>>
>>     0.187  |     Device : ven_10DE, dev_1244, 
>> subsys_83C21043                                                               
>> -- 
>> com.sun.prism.d3d.D3DPipeline.printDriverInformation(D3DPipeline.java:94) 
>>
>>     0.220  | javafx.runtime.version: 
>> 2.2.0-beta-b11                                                                      
>> -- hs.mediasystem.FrontEnd.start(FrontEnd.java:75)
>>     1.401  | -> RESIZE: 2187154536045615 w: 1440 h: 
>> 860                                                                  --
>> com.sun.javafx.tk.quantum.GlassViewEventHandler.handleViewEvent(GlassViewEventHandler.java:444) 
>>
>>     1.411  | ProgramController.registerService() - registering new 
>> service: 
>> hs.mediasystem.screens.SubtitleDownloadService at 8e4e40                --
>> hs.mediasystem.screens.ProgramController.registerWorker(ProgramController.java:430) 
>>
>>     1.413  | ProgramController.registerService() - registering new 
>> service: hs.mediasystem.screens.GroupWorker at 2e9f9e    -- 
>> hs.mediasystem.screens.ProgramController.registerWorker(ProgramController.java:430)
>>     1.659 *| Database up to date at version 
>> 11                                                                           
>> -- 
>> hs.mediasystem.db.DatabaseUpdater.updateDatabase(DatabaseUpdater.java:43) 
>>
>>     1.663 *| Navigator.navigateTo() - Destination('Home'; 
>> modal=false)                                                   -- 
>> hs.mediasystem.screens.Navigator.navigateTo(Navigator.java:71)
>>     1.702  | RESIZE: 2187154837492176 w: 1920 h: 1200 
>



More information about the openjfx-dev mailing list