Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(2)

Issue 3404041: Review: invalidation bug fix (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
13 years, 5 months ago by larrygritz
Modified:
13 years, 4 months ago
Reviewers:
oiio-dev, ckulla
Base URL:
http://svn.openimageio.org/oiio/trunk/
Visibility:
Public.

Description

Chasing some test failures that occurred after the recent mipmap/subimage changes, I found the following bug. I think it's always been wrong, but only became symptomatic after that change. The short story is that I was sloppy about sometimes using m_invalid, and other times m_subimages.size()>0 as tests for whether the specs were read and valid, but wasn't in fact ensuring that they always were in sync. This caused some very subtle problems after files were invalidated, cascading into using a spec that was no longer valid memory. This patch refactors a bit and fixes it up. I believe it was a problem all along, but the memory was being reused "in place" before, so the values were still as expected. The one trick to it all is that in eliminating the inconsistency, in invalidate() I no longer re-open and re-close the file. I can't think of a good reason to do that now, but obviously at some point I thought it was necessary. We pass all tests (including OSL and Arnold testsuites), so I don't think this breaks anything, but I want you reviewers to think hard about whether I'm forgetting something.

Patch Set 1 #

Total comments: 4
Unified diffs Side-by-side diffs Delta from patch set Stats (+33 lines, -6 lines) Patch
src/libtexture/imagecache.cpp View 6 chunks +14 lines, -6 lines 4 comments Download
src/libtexture/imagecache_pvt.h View 1 chunk +19 lines, -0 lines 0 comments Download

Messages

Total messages: 3
larrygritz
13 years, 5 months ago (2010-12-02 06:45:21 UTC) #1
ckulla
http://codereview.appspot.com/3404041/diff/1/src/libtexture/imagecache.cpp File src/libtexture/imagecache.cpp (right): http://codereview.appspot.com/3404041/diff/1/src/libtexture/imagecache.cpp#newcode364 src/libtexture/imagecache.cpp:364: // If m_subimages has already been filled out, we've ...
13 years, 5 months ago (2010-12-02 17:09:13 UTC) #2
larrygritz
13 years, 5 months ago (2010-12-02 17:47:36 UTC) #3
http://codereview.appspot.com/3404041/diff/1/src/libtexture/imagecache.cpp
File src/libtexture/imagecache.cpp (right):

http://codereview.appspot.com/3404041/diff/1/src/libtexture/imagecache.cpp#ne...
src/libtexture/imagecache.cpp:364: // If m_subimages has already been filled
out, we've opened this file
On 2010/12/02 17:09:14, ckulla wrote:
> Should this comment be updated?

Will do.

http://codereview.appspot.com/3404041/diff/1/src/libtexture/imagecache.cpp#ne...
src/libtexture/imagecache.cpp:885: // FIXME -- why do we need to reopen here? 
Why reload the spec?
On 2010/12/02 17:09:14, ckulla wrote:
> What if the file changes on disk? (new resolution for example?)

Yeah, I think that's the point.  Clearing validspec here is what ensures that
next time we need something from the file, we will read the header again.  It
will need to open() it at that point, which is how the spec gets filled in and
marked as valid.
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b