Changeset View
Standalone View
source/graphics/TextureManager.cpp
/* Copyright (C) 2018 Wildfire Games. | /* Copyright (C) 2019 Wildfire Games. | ||||
elexis: (`ok` **uninitialized**) | |||||
Not Done Inline ActionsThen it is probably the best to initialize it with false LukeV1: Then it is probably the best to initialize it with `false`
| |||||
Not Done Inline ActionsIf ok = true, then the pointer should be valid, if it was behaving kindly. One shouldn't have to doublecheck, i.e. the check should be adapted sooner. in m_TextureConverter.Poll. Either there is an error that can be caught but wasnt caught (one of those 3 positive INFO return values), or everything went as expected, but due the some missing threading safety measure, something cleaned the buffer after the Poll call but before the ok check?
That sounds like it knowingly returns ok = true and texture == nullptr. elexis: If `ok` = true, then the pointer should be valid, if it was behaving kindly. One shouldn't have… | |||||
Not Done Inline ActionsOk. That means I will revert the changes here and place them somewhere in m_TextureConverter.Poll if needed..
That would probably be quite hard to find out. I will check all other opportunities first.. LukeV1: Ok. That means I will revert the changes here and place them somewhere in `m_TextureConverter. | |||||
* This file is part of 0 A.D. | * This file is part of 0 A.D. | ||||
* | * | ||||
* 0 A.D. is free software: you can redistribute it and/or modify | * 0 A.D. is free software: you can redistribute it and/or modify | ||||
* it under the terms of the GNU General Public License as published by | * it under the terms of the GNU General Public License as published by | ||||
* the Free Software Foundation, either version 2 of the License, or | * the Free Software Foundation, either version 2 of the License, or | ||||
* (at your option) any later version. | * (at your option) any later version. | ||||
* | * | ||||
* 0 A.D. is distributed in the hope that it will be useful, | * 0 A.D. is distributed in the hope that it will be useful, | ||||
▲ Show 20 Lines • Show All 346 Lines • ▼ Show 20 Lines | // Process any completed conversion tasks | ||||
if (m_TextureConverter.Poll(texture, dest, ok)) | if (m_TextureConverter.Poll(texture, dest, ok)) | ||||
{ | { | ||||
if (ok) | if (ok) | ||||
{ | { | ||||
LoadTexture(texture, dest); | LoadTexture(texture, dest); | ||||
} | } | ||||
else | else | ||||
{ | { | ||||
if(texture != nullptr) | |||||
{ | |||||
LOGERROR("Texture failed to convert: \"%s\"", texture->m_Properties.m_Path.string8()); | LOGERROR("Texture failed to convert: \"%s\"", texture->m_Properties.m_Path.string8()); | ||||
texture->SetHandle(m_ErrorHandle); | texture->SetHandle(m_ErrorHandle); | ||||
} | } | ||||
else | |||||
{ | |||||
LOGERROR("Texture failed to convert: returned nullptr"); | |||||
return true; | |||||
} | |||||
} | |||||
texture->m_State = CTexture::LOADED; | texture->m_State = CTexture::LOADED; | ||||
return true; | return true; | ||||
} | } | ||||
} | } | ||||
// We'll only push new conversion requests if it's not already busy | // We'll only push new conversion requests if it's not already busy | ||||
bool converterBusy = m_TextureConverter.IsBusy(); | bool converterBusy = m_TextureConverter.IsBusy(); | ||||
▲ Show 20 Lines • Show All 311 Lines • Show Last 20 Lines |
(ok uninitialized)