HomeWildfire Games

Fix rP24306 - actually speed up MP/lobby chat.
Concern RaisedrP24312

Description

Fix rP24306 - actually speed up MP/lobby chat.

rP24306 / D1781 would fix an important source of lag... If it actually used the code.
Also clean up some comments.

Reported by: Vladislav

Differential Revision: https://code.wildfiregames.com/D3176

Event Timeline

vladislavbelov raised a concern with this commit.Dec 2 2020, 7:04 PM
vladislavbelov added a subscriber: vladislavbelov.
vladislavbelov added inline comments.
/ps/trunk/source/gui/ObjectTypes/CList.cpp
129

That makes things more dangerous. Since you haven't added any explicit dependency, that SetupText(true) can't be called before SetupText(false).

Usually appending should work for an empty container like assigning, not UB.

This commit now has outstanding concerns.Dec 2 2020, 7:05 PM
wraitii added inline comments.Dec 2 2020, 7:13 PM
/ps/trunk/source/gui/ObjectTypes/CList.cpp
129

Indeed... In fact back() was actually not equivalent to the code before, because that used m_List.m_Items instead of m_ItemsYPositions's length, which is why I needed to move this line and didn't see the UB.

It so happens that SetupText() is called immediately because we have a scrollbar, but I'll fix it regardless.

vladislavbelov added inline comments.Dec 3 2020, 1:24 PM
/ps/trunk/source/gui/ObjectTypes/CList.cpp
131

I suppose m_List.m_Items can be empty, so there is a dangerous code still.

wraitii added inline comments.Dec 3 2020, 1:26 PM
/ps/trunk/source/gui/ObjectTypes/CList.cpp
131

Mh, yeah, this list is always appended to before calling SetupText with append, but it is a bit of a gotcha.