Skip to content

fix: catch exceptions in print-uncaught-messages destructor#5103

Open
lgritz wants to merge 1 commit intoAcademySoftwareFoundation:mainfrom
lgritz:lg-ib-dtr
Open

fix: catch exceptions in print-uncaught-messages destructor#5103
lgritz wants to merge 1 commit intoAcademySoftwareFoundation:mainfrom
lgritz:lg-ib-dtr

Conversation

@lgritz
Copy link
Collaborator

@lgritz lgritz commented Mar 21, 2026

Fixes #5063

In that issue, it was reported that the printing of any unretrieved error messages upon destruction of an ImageBuf could itself have an exception (including if it, for some reason, could not correctly fwrite the output). And if that is the case, it could terminate the app.

So for safety, this patch encloses this particular print statement in a try/catch. And also found another in ErrorHolder in the internals of Strutil, which is used for "global" errors issued to OIIO::errorfmt().

Assisted-by: Claude Code / Opus 4.6

I did the fix in ImageBuf, then Claude found the other spot in ErrorHolder that also needed the fix.

Fixes 5063

In that issue, it was reported that the printing of any unretrieved
error messages upon destruction of an ImageBuf could itself have an
exception (including if it, for some reason, could not correctly
fwrite the output). And if that is the case, it could terminate the
app.

So for safety, this patch encloses this particular print statement in
a try/catch. And also found another in ErrorHolder in the internals of
Strutil, which is used for "global" errors issued to OIIO::errorfmt().

Assisted-by: Claude Code / Opus 4.6

I did the fix in ImageBuf, then Claude found the other spot in
ErrorHolder that also needed the fix.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: ImageBuf destructor crashes application if OIIO::print fails

1 participant