DELETED Changing line size - unexpected results
The matrix stack has nothing to do with “color, size”. The matrix stack affects matrices, and that’s all; that’s why it’s called the “matrix stack”.
Any “experience” you have that tells you otherwise is mistaken, likely do to some misunderstanding of what your code is actually doing.
And you seriously need to learn how to use a debugger at this point.
In any case, what’s happening is likely all based on that: the line width is not being reset to some default value just because you popped the matrix stack. Like any other state, it retains the value you gave it in perpetuity, until some point where you give it another value.
So the very first time you draw, the first line(s?) will use the default line width of 1, but every subsequent time the rendering code is called, the line width will be 5. Forever. So that’s what gets used.
And it’s likely that your drawing code gets called multiple times in rapid succession at the start of your program, so you never actually see the initial rendering where you got the default line width.
Again, this is why you need to use a debugger.