-
Notifications
You must be signed in to change notification settings - Fork 542
8368629: Texture.update sometimes invoked for a disposed Texture #1951
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
662f03d
f7c452e
1e1832f
683b659
10cc7fd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -88,6 +88,10 @@ public D3DContext getContext() { | |
| @Override | ||
| public void update(MediaFrame frame, boolean skipFlush) | ||
| { | ||
| if (!resource.isValid()) { | ||
| return; | ||
| } | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. are these the only two places where we need the check?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, as far as I know other Prism-backend-specific resources already do similar checks, either Java side or Native side. |
||
|
|
||
| if (frame.getPixelFormat() == PixelFormat.MULTI_YCbCr_420) { | ||
| // shouldn't have gotten this far | ||
| throw new IllegalArgumentException("Unsupported format "+frame.getPixelFormat()); | ||
|
|
@@ -138,6 +142,10 @@ public void update(Buffer pixels, PixelFormat format, | |
| int srcscan, | ||
| boolean skipFlush) | ||
| { | ||
| if (!resource.isValid()) { | ||
| return; | ||
| } | ||
|
|
||
| checkUpdateParams(pixels, format, | ||
| dstx, dsty, srcx, srcy, srcw, srch, srcscan); | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -657,6 +657,10 @@ public void update(Buffer pixels, PixelFormat format, | |
| int srcw, int srch, | ||
| int srcscan, | ||
| boolean skipFlush) { | ||
| if (!resource.isValid()) { | ||
| return; | ||
| } | ||
|
|
||
| checkUpdateParams(pixels, format, | ||
| dstx, dsty, srcx, srcy, srcw, srch, srcscan); | ||
|
|
||
|
|
@@ -774,6 +778,10 @@ public void update(Buffer pixels, PixelFormat format, | |
|
|
||
| @Override | ||
| public void update(MediaFrame frame, boolean skipFlush) { | ||
| if (!resource.isValid()) { | ||
| return; | ||
| } | ||
|
|
||
|
Comment on lines
+781
to
+784
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see that you applied this to both D3D and ES2. The corresponding MTLTexture also has an |
||
| if (!skipFlush) { | ||
| context.flushVertexBuffer(); | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
related - D3DTextureResource line 40 is
should there be
resource = null;afterresource.dispose()?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It could add another layer of safety and make any potential future NPEs more easy to track - I'll add this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In looking more closely at the code, it looks like adding
resource = nullinfree()is redundant, since every caller offree()already does it right after calling it. It doesn't seem harmful, though.