White square in SFML, but texture is loading fine
<p>I have a DBObject that stores <code>media</code> (an <code>sf::Sprite</code>) and <code>mediaTexture</code> (an <code>sf::Texture</code>). This is my <code>DBObject::loadMedia()</code> function:</p>

<pre><code>void DBObject::loadMedia() {
    myStream mediaStream(mediaPath);
    mediaTexture.loadFromStream(mediaStream);
    media.setTexture(mediaTexture);
    mediaInit = true;
}
</code></pre>

<p>These DBObjects are stored in a <code>std::vector</code>.</p>

<p>When I try to draw the sprite to the display, it is completely white, and apparently this is from the texture going out of scope. But I define the texture in the DBObject, so it should have a lifetime of the object... right?</p>

<p>However, when I make a NEW sprite in my main() function, and do <code>newSprite.setTexture(DBObj.mediaTexture)</code>, it is displayed fine, so the texture itself is loading fine, but something is happening to the sprite.</p>