Skip to content

Commit

Permalink
Erase any dangling error messages when objects that report errors are…
Browse files Browse the repository at this point in the history
… destroyed.

Signed-off-by: Chris Kulla <ckulla@gmail.com>
  • Loading branch information
fpsunflower committed Apr 12, 2024
1 parent bab0860 commit d7e1afe
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 6 deletions.
6 changes: 5 additions & 1 deletion src/libOpenImageIO/imageinput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,11 @@ ImageInput::ImageInput()



ImageInput::~ImageInput() {}
ImageInput::~ImageInput() {
// Erase any leftover errors from this thread
// TODO: can we clear other threads' errors?
input_error_messages.erase(this);
}



Expand Down
6 changes: 5 additions & 1 deletion src/libOpenImageIO/imageoutput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,11 @@ ImageOutput::ImageOutput()



ImageOutput::~ImageOutput() {}
ImageOutput::~ImageOutput() {
// Erase any leftover errors from this thread
// TODO: can we clear other threads' errors?
output_error_messages.erase(this);
}



Expand Down
3 changes: 3 additions & 0 deletions src/libtexture/imagecache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1722,6 +1722,9 @@ ImageCacheImpl::~ImageCacheImpl()
spin_lock lock(m_perthread_info_mutex);
m_all_perthread_info.clear();
}
// Erase any leftover errors from this thread
// TODO: can we clear other threads' errors?
imcache_error_messages.erase(this);
}


Expand Down
13 changes: 9 additions & 4 deletions src/libtexture/texturesys.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -351,8 +351,16 @@ TextureSystemImpl::init()
}


static thread_local tsl::robin_map<const TextureSystemImpl*, std::string>
txsys_error_messages;

TextureSystemImpl::~TextureSystemImpl() { printstats(); }

TextureSystemImpl::~TextureSystemImpl() {
printstats();
// Erase any leftover errors from this thread
// TODO: can we clear other threads' errors?
txsys_error_messages.erase(this);
}



Expand Down Expand Up @@ -893,9 +901,6 @@ TextureSystemImpl::get_texels(TextureHandle* texture_handle_,
return ok;
}

static thread_local tsl::robin_map<const TextureSystemImpl*, std::string>
txsys_error_messages;

bool
TextureSystemImpl::has_error() const
{
Expand Down

0 comments on commit d7e1afe

Please sign in to comment.