Window Resize Spam
lansdon-qualta opened this issue · 12 comments
In version 3.6.1+ we are getting infinite window resize event spam. Nested elements are constantly firing window resize events. This is after trying to resize the main window. Not sure the source but when we revert to 3.6.0 the problem seems to not be present.
There are only 4 commits in version 3.6.1 - would you be able to find mention the commit that makes the difference for your with regard to the infinite spam loop together with a test layout and a way to actually verify the spam?
The list of relevant commits is shown towards the bottom of the Readme.md file.
You can use any of the available test applications in the project - just modify it for the test case such that the problem becomes more obvious, thanks Dirk
If I had to guess I would say this commit looks suspicious and directly related to making nested elements run resize-like events:
[https://github.com/Dirkster99/AvalonDock/commit/8f20e135df660b823494061f4ff63b78cdcdd008#diff-f04b9af42e4129457a18f32d34d43f57]
Yes, I looked at it and was just about to write the same (you've beaten me by 20 seconds) - its funny that the issue item updates while you type if someone else is faster :-) - I am not completely sure about a fix right now but maybe just caching the last value and comparing it with the new value and only calling the RaiseChildrenTreeChanged()
when the size differ is already the fix to remove the spam(?).
@scdmitryvodich Do you see a better fix to optimize this problem?
This commit solved the #81 issue. I'll investigate if a better solution can be found.
@lansdon-qualta I have a couple of questions concerning this issue:
- Which event is exactly fired (ChildrenTreeChanged or some else)?
- Do you get some infinite loop of events or are there just a lot of them?
- Would it be possible to provide a description of steps to reproduce the exact issue you are facing?
Our environment is a bit complicated but I'll see if this helps.
- The event that is causing us issues is actually a symptom of this. It's a SizeChanged event coming from a nested VisualData3DViewPort or DxViewportView (AB4D.com).
- It's hard to tell the exact frequency but in the log it appears to be happening ~2x / second. It happens non stop after we resize the MainWindow of the application. It's frequent enough to lock up the UI completely to the point where we can't interact with UI at all. (granted, some of that could be the subsequent code called by the event subscribers.
- Steps (in our environment)
a. Resize the application/main window to be not maximized.
b. Maximize the application/main window
c. SizeChanged events are propagated repeatedly by the 3dViewPort
Like I said, if we revert to 3.6.0 it doesn't happen, if we upgrade to 3.6.1 or 3.6.2 it starts happening making the application unusable.
@lansdon-qualta Thank you! I'll try to investigate it.
@lansdon-qualta Could you please have a look if changes in #103 solve your issue?
@lansdon-qualta @Dirkster99 Could you please have a look if changes in #103 may solve this issue?
It looks like it fixed the problem I was having. Using the new .dll I lost mouse click events in my nested viewport, but looking at your code change, it doesn't seem related? Not sure. The spam stopped though.
Mouse click events should not be affected by this change.
I merged the change as it does seem to address the issue without introducing new problems (as far as I can see). This change is currently available in the master branch and should also be available in the next release NuGet version.
Thanks for your great work and feedbacks @scdmitryvodich and @lansdon-qualta