Skip to content
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

fix(Canvas): safeguard dispose #7775

Merged
merged 12 commits into from Apr 1, 2022
Merged

fix(Canvas): safeguard dispose #7775

merged 12 commits into from Apr 1, 2022

Conversation

ShaMan123
Copy link
Contributor

closes #7664

@github-actions
Copy link
Contributor

github-actions bot commented Mar 8, 2022

Code Coverage Summary

> fabric@5.1.0 coverage:report
> nyc report --reporter=lcov --reporter=text

-----------|---------|----------|---------|---------|-----------------------------------------------
File       | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s                             
-----------|---------|----------|---------|---------|-----------------------------------------------
All files  |    83.2 |    76.58 |   86.32 |   82.92 |                                               
 fabric.js |    83.2 |    76.58 |   86.32 |   82.92 | ...,29862,29987,30067-30132,30255,30354,30571 
-----------|---------|----------|---------|---------|-----------------------------------------------

@github-actions
Copy link
Contributor

github-actions bot commented Mar 8, 2022

Code Coverage Summary

> fabric@5.1.0 coverage:report
> nyc report --reporter=lcov --reporter=text

-----------|---------|----------|---------|---------|-----------------------------------------------
File       | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s                             
-----------|---------|----------|---------|---------|-----------------------------------------------
All files  |   83.15 |    76.55 |   86.32 |   82.87 |                                               
 fabric.js |   83.15 |    76.55 |   86.32 |   82.87 | ...,29862,29987,30067-30132,30255,30354,30571 
-----------|---------|----------|---------|---------|-----------------------------------------------

1 similar comment
@github-actions
Copy link
Contributor

github-actions bot commented Mar 8, 2022

Code Coverage Summary

> fabric@5.1.0 coverage:report
> nyc report --reporter=lcov --reporter=text

-----------|---------|----------|---------|---------|-----------------------------------------------
File       | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s                             
-----------|---------|----------|---------|---------|-----------------------------------------------
All files  |   83.15 |    76.55 |   86.32 |   82.87 |                                               
 fabric.js |   83.15 |    76.55 |   86.32 |   82.87 | ...,29862,29987,30067-30132,30255,30354,30571 
-----------|---------|----------|---------|---------|-----------------------------------------------

@ShaMan123 ShaMan123 requested a review from asturur March 8, 2022 11:24
@github-actions
Copy link
Contributor

github-actions bot commented Mar 8, 2022

Code Coverage Summary

> fabric@5.1.0 coverage:report
> nyc report --reporter=lcov --reporter=text

-----------|---------|----------|---------|---------|-----------------------------------------------
File       | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s                             
-----------|---------|----------|---------|---------|-----------------------------------------------
All files  |    83.2 |    76.58 |   86.32 |   82.92 |                                               
 fabric.js |    83.2 |    76.58 |   86.32 |   82.92 | ...,29862,29987,30067-30132,30255,30354,30571 
-----------|---------|----------|---------|---------|-----------------------------------------------

@github-actions
Copy link
Contributor

github-actions bot commented Mar 8, 2022

Code Coverage Summary

> fabric@5.1.0 coverage:report
> nyc report --reporter=lcov --reporter=text

-----------|---------|----------|---------|---------|-----------------------------------------------
File       | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s                             
-----------|---------|----------|---------|---------|-----------------------------------------------
All files  |   83.19 |    76.55 |   86.32 |   82.91 |                                               
 fabric.js |   83.19 |    76.55 |   86.32 |   82.91 | ...,29862,29987,30067-30132,30255,30354,30571 
-----------|---------|----------|---------|---------|-----------------------------------------------

@stale
Copy link

stale bot commented Mar 27, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale Issue marked as stale by the stale bot label Mar 27, 2022
@ShaMan123 ShaMan123 added fix-next and removed stale Issue marked as stale by the stale bot labels Mar 28, 2022
@asturur asturur self-assigned this Mar 28, 2022
Copy link
Member

@asturur asturur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you check which of the 2 changes it the real fix?

@github-actions
Copy link
Contributor

github-actions bot commented Mar 29, 2022

Code Coverage Summary

> fabric@5.1.0 coverage:report
> nyc report --reporter=lcov --reporter=text

-----------|---------|----------|---------|---------|-----------------------------------------------
File       | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s                             
-----------|---------|----------|---------|---------|-----------------------------------------------
All files  |   83.15 |    76.54 |   86.23 |   82.87 |                                               
 fabric.js |   83.15 |    76.54 |   86.23 |   82.87 | ...,29909,30034,30114-30179,30302,30401,30637 
-----------|---------|----------|---------|---------|-----------------------------------------------

@github-actions
Copy link
Contributor

github-actions bot commented Mar 29, 2022

Code Coverage Summary

> fabric@5.1.0 coverage:report
> nyc report --reporter=lcov --reporter=text

-----------|---------|----------|---------|---------|-----------------------------------------------
File       | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s                             
-----------|---------|----------|---------|---------|-----------------------------------------------
All files  |   83.14 |     76.5 |   86.23 |   82.86 |                                               
 fabric.js |   83.14 |     76.5 |   86.23 |   82.86 | ...,29909,30034,30114-30179,30302,30401,30637 
-----------|---------|----------|---------|---------|-----------------------------------------------

@ShaMan123
Copy link
Contributor Author

ShaMan123 commented Mar 29, 2022

Can you check which of the 2 changes it the real fix?

Both are the real fix.
Added another test for setting dimensions and disposing.
Made me encounter a race condition between dispose and render.
If you look at the test you can see I had to wrap the disposing in an event to wait for after rendering.
I think this should be standard behavior handled internally by canvas, returning a promise once disposing has completed.
Thoughts?
But as you often suggest, let's limit the scope of this PR.
This on my end it's ready.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 30, 2022

Code Coverage Summary

> fabric@5.1.0 coverage:report
> nyc report --reporter=lcov --reporter=text

-----------|---------|----------|---------|---------|-----------------------------------------------
File       | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s                             
-----------|---------|----------|---------|---------|-----------------------------------------------
All files  |   83.14 |     76.5 |   86.23 |   82.86 |                                               
 fabric.js |   83.14 |     76.5 |   86.23 |   82.86 | ...,29909,30034,30114-30179,30302,30401,30637 
-----------|---------|----------|---------|---------|-----------------------------------------------

@github-actions
Copy link
Contributor

github-actions bot commented Mar 30, 2022

Code Coverage Summary

> fabric@5.1.0 coverage:report
> nyc report --reporter=lcov --reporter=text

-----------|---------|----------|---------|---------|-----------------------------------------------
File       | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s                             
-----------|---------|----------|---------|---------|-----------------------------------------------
All files  |   83.15 |    76.54 |   86.23 |   82.87 |                                               
 fabric.js |   83.15 |    76.54 |   86.23 |   82.87 | ...,29909,30034,30114-30179,30302,30401,30637 
-----------|---------|----------|---------|---------|-----------------------------------------------

@github-actions
Copy link
Contributor

github-actions bot commented Mar 30, 2022

Code Coverage Summary

> fabric@5.1.0 coverage:report
> nyc report --reporter=lcov --reporter=text

-----------|---------|----------|---------|---------|-----------------------------------------------
File       | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s                             
-----------|---------|----------|---------|---------|-----------------------------------------------
All files  |   83.18 |    76.55 |   86.29 |    82.9 |                                               
 fabric.js |   83.18 |    76.55 |   86.29 |    82.9 | ...,29913,30038,30118-30183,30306,30405,30641 
-----------|---------|----------|---------|---------|-----------------------------------------------

@github-actions
Copy link
Contributor

github-actions bot commented Mar 30, 2022

Code Coverage Summary

> fabric@5.1.0 coverage:report
> nyc report --reporter=lcov --reporter=text

-----------|---------|----------|---------|---------|-----------------------------------------------
File       | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s                             
-----------|---------|----------|---------|---------|-----------------------------------------------
All files  |   83.13 |    76.52 |   86.29 |   82.85 |                                               
 fabric.js |   83.13 |    76.52 |   86.29 |   82.85 | ...,29913,30038,30118-30183,30306,30405,30641 
-----------|---------|----------|---------|---------|-----------------------------------------------

@ShaMan123
Copy link
Contributor Author

I'll explain.
Using cssText solves the problem of trying to set read only props (and is better for perf I think)
Only an interactive canvas changes lowerCanvasEl style so that's why I wrapped the style restoration as well

@asturur
Copy link
Member

asturur commented Apr 1, 2022

weird i would imagine this
https://github.com/fabricjs/fabric.js/pull/7775/files#diff-fc54cc24e3c94d9201b66567331262bc363a509f49283a00e715aa3bf08dce35R1559-R1562
would take care of interaction between disposing and rendering

@ShaMan123 ShaMan123 merged commit 6b64132 into master Apr 1, 2022
@ShaMan123 ShaMan123 deleted the fix-canvas-dispose branch April 1, 2022 22:18
@ShaMan123
Copy link
Contributor Author

weird i would imagine this https://github.com/fabricjs/fabric.js/pull/7775/files#diff-fc54cc24e3c94d9201b66567331262bc363a509f49283a00e715aa3bf08dce35R1559-R1562 would take care of interaction between disposing and rendering

The link doesn't open properly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error calling toDataUrl() after upgraded to 5.0.0
2 participants