The Texture2D load function uses SharedPtr to automate memory management when it needs to request lower sized mips from Image. In that case the initial image pointer is overwritten with each smaller mip, and as the loading proceeds, each previous intermediate mip is automatically freed. That could however be refactored to take the initial image as a raw pointer, and use the SharedPtr in the mip loading loop only.
HelloGUI code is simply non-idiomatic code and needs to be refactored so that unnecessary refcount management and giving an overly convoluted example is avoided.
EDIT: took a detailed look, having Texture2D/3D/Cube take in an image raw pointer would potentially be dangerous, or need making the code a lot more complicated. As the mip loop promotes the image to shared pointer, it has the danger of deleting the image if it was not held in a shared pointer to begin with, and in that sense it’s better to make it explicit in the function signature that a SharedPtr is being used.