The documentation for invalidateFramebufferObject claims:
Call this function during synchronize() to invalidate the current FBO. This will result in a new FBO being created with createFramebufferObject().
This function sets the invalidatePending flag, which is then tested in updatePaintNode. However, if the size of the framebuffer matches the desired size (which is usually the case), then the fbo will not be reset and createFramebufferObject will not be called subsequently.
(tested in 5.5.1, but code appears unchanged in latest)