mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-26 08:05:38 +00:00
Fixed really sneaky texture deallocation bug.
Textures allocated with no path (e.g. the transition image which uses copyScreen()) weren't being deinitialized with the renderer. Which meant something else could take the old texture ID, and when the no-path texture got destroyed, it would take a texture along with it.
This commit is contained in:
parent
55b71fab49
commit
92adc41cd6
|
@ -127,7 +127,10 @@ void Font::init(ResourceData data)
|
||||||
void Font::deinit()
|
void Font::deinit()
|
||||||
{
|
{
|
||||||
if(textureID)
|
if(textureID)
|
||||||
|
{
|
||||||
glDeleteTextures(1, &textureID);
|
glDeleteTextures(1, &textureID);
|
||||||
|
textureID = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Font::buildAtlas(ResourceData data)
|
void Font::buildAtlas(ResourceData data)
|
||||||
|
@ -246,7 +249,7 @@ void Font::buildAtlas(ResourceData data)
|
||||||
deinit();
|
deinit();
|
||||||
init(data);
|
init(data);
|
||||||
}else{
|
}else{
|
||||||
LOG(LogInfo) << "Created font \"" << mPath << "\" with size " << mSize << ".";
|
LOG(LogInfo) << "Created font \"" << mPath << "\" with size " << mSize << ". textureID: " << textureID;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -113,7 +113,11 @@ void GuiGameList::setSystemId(int id)
|
||||||
void GuiGameList::render(const Eigen::Affine3f& parentTrans)
|
void GuiGameList::render(const Eigen::Affine3f& parentTrans)
|
||||||
{
|
{
|
||||||
Eigen::Affine3f trans = parentTrans * getTransform();
|
Eigen::Affine3f trans = parentTrans * getTransform();
|
||||||
|
|
||||||
renderChildren(trans);
|
renderChildren(trans);
|
||||||
|
|
||||||
|
Renderer::setMatrix(trans);
|
||||||
|
mTheme->getDescriptionFont()->drawText("DESCRIPTION TEXT", Eigen::Vector2f::Zero(), 0xFF0000FF);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GuiGameList::input(InputConfig* config, Input input)
|
bool GuiGameList::input(InputConfig* config, Input input)
|
||||||
|
@ -338,6 +342,8 @@ void GuiGameList::updateTheme()
|
||||||
mList.setCentered(true);
|
mList.setCentered(true);
|
||||||
mList.setPosition(0, mList.getPosition().y());
|
mList.setPosition(0, mList.getPosition().y());
|
||||||
mList.setTextOffsetX(0);
|
mList.setTextOffsetX(0);
|
||||||
|
|
||||||
|
//mDescription.setFont(nullptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -490,6 +496,7 @@ void GuiGameList::updateGameLaunchEffect(int t)
|
||||||
if(t > endTime)
|
if(t > endTime)
|
||||||
{
|
{
|
||||||
//effect done
|
//effect done
|
||||||
|
mTransitionImage.setImage(""); //fixes "tried to bind uninitialized texture!" since copyScreen()'d textures don't reinit
|
||||||
mSystem->launchGame(mWindow, (GameData*)mList.getSelectedObject());
|
mSystem->launchGame(mWindow, (GameData*)mList.getSelectedObject());
|
||||||
mEffectFunc = &GuiGameList::updateGameReturnEffect;
|
mEffectFunc = &GuiGameList::updateGameReturnEffect;
|
||||||
mEffectTime = 0;
|
mEffectTime = 0;
|
||||||
|
|
|
@ -71,9 +71,6 @@ void ImageComponent::resize()
|
||||||
|
|
||||||
void ImageComponent::setImage(std::string path)
|
void ImageComponent::setImage(std::string path)
|
||||||
{
|
{
|
||||||
if(mPath == path)
|
|
||||||
return;
|
|
||||||
|
|
||||||
mPath = path;
|
mPath = path;
|
||||||
|
|
||||||
if(mPath.empty() || !mWindow->getResourceManager()->fileExists(mPath))
|
if(mPath.empty() || !mWindow->getResourceManager()->fileExists(mPath))
|
||||||
|
|
|
@ -105,7 +105,11 @@ void TextureResource::bind() const
|
||||||
std::shared_ptr<TextureResource> TextureResource::get(ResourceManager& rm, const std::string& path)
|
std::shared_ptr<TextureResource> TextureResource::get(ResourceManager& rm, const std::string& path)
|
||||||
{
|
{
|
||||||
if(path.empty())
|
if(path.empty())
|
||||||
return std::shared_ptr<TextureResource>(new TextureResource(rm, path));
|
{
|
||||||
|
std::shared_ptr<TextureResource> tex(new TextureResource(rm, ""));
|
||||||
|
rm.addReloadable(tex); //make sure we're deinitialized even though we do nothing on reinitialization
|
||||||
|
return tex;
|
||||||
|
}
|
||||||
|
|
||||||
auto foundTexture = sTextureMap.find(path);
|
auto foundTexture = sTextureMap.find(path);
|
||||||
if(foundTexture != sTextureMap.end())
|
if(foundTexture != sTextureMap.end())
|
||||||
|
|
Loading…
Reference in a new issue