Skip to content

Conversation

@izulin
Copy link
Collaborator

@izulin izulin commented Jul 31, 2021

Context

Simpler version of #786

How has this been tested?

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature or improvement (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Additional language file or change to the existing one (translations)

Related issue(s):

Checklist:

  • My code follows the code style of this project,
  • My change requires a change to the documentation,
  • I described the modification in the CHANGELOG.md file.
@izulin izulin requested a review from wojciechczerniak July 31, 2021 09:47
@codecov
Copy link

codecov bot commented Jul 31, 2021

Codecov Report

Merging #788 (b194edf) into develop (f411eba) will increase coverage by 0.09%.
The diff coverage is 83.33%.

Impacted file tree graph

@@ Coverage Diff @@ ## develop #788 +/- ## =========================================== + Coverage 92.34% 92.43% +0.09%  =========================================== Files 166 167 +1 Lines 40347 40290 -57 Branches 3719 3722 +3 =========================================== - Hits 37257 37241 -16  + Misses 3084 3043 -41  Partials 6 6 
Impacted Files Coverage Δ
src/CellContentParser.ts 64.32% <ø> (-0.20%) ⬇️
src/ContentChanges.ts 93.58% <ø> (-0.17%) ⬇️
...c/DependencyGraph/AddressMapping/AddressMapping.ts 80.63% <ø> (+0.54%) ⬆️
src/DependencyGraph/ArrayMapping.ts 78.23% <ø> (+0.74%) ⬆️
src/DependencyGraph/Graph.ts 94.65% <ø> (+1.70%) ⬆️
src/DependencyGraph/RangeMapping.ts 88.69% <ø> (+0.52%) ⬆️
src/DependencyGraph/SheetMapping.ts 93.93% <ø> (+1.96%) ⬆️
src/Evaluator.ts 95.86% <ø> (+1.23%) ⬆️
src/LazilyTransformingAstService.ts 95.06% <ø> (+3.20%) ⬆️
src/Lookup/ColumnBinarySearch.ts 93.75% <ø> (-0.19%) ⬇️
... and 12 more

public destroy() {
if (this.gpu) {
this.gpu.destroy()
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure about removing this one. GPU.js docs say that we should run a proper cleanup: https://github.com/gpujs/gpu.js/#cleanup

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ok, this should be then delegated to the main-class destroy.

Comment on lines 4291 to 4294
for(const key of Object.keys(this)) {
delete (this as Record<string, any>)[key]
}
Object.setPrototypeOf(this, null)
Copy link
Contributor

Choose a reason for hiding this comment

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

This will end up with an error being thrown xxx is not a function if someone will try to call methods on a destroyed instance. It is a good solution but maybe HOT has a better example. As @budnix pointed we replace all the functions with postMortem method: https://github.com/handsontable/handsontable/blob/b0a09bde9a9d4164bee4f28cd047fa843f42a7a9/src/core.js#L4006-L4016

And the postMortem method displays a warning:
https://github.com/handsontable/handsontable/blob/b0a09bde9a9d4164bee4f28cd047fa843f42a7a9/src/core.js#L4043-L4047

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

good idea

@wojciechczerniak wojciechczerniak mentioned this pull request Aug 4, 2021
7 tasks
@izulin izulin requested a review from wojciechczerniak August 4, 2021 20:38
@lgtm-com
Copy link
Contributor

lgtm-com bot commented Aug 4, 2021

This pull request fixes 1 alert when merging b194edf into f411eba - view on LGTM.com

fixed alerts:

  • 1 for Unused variable, import, function or class
Copy link
Contributor

@wojciechczerniak wojciechczerniak left a comment

Choose a reason for hiding this comment

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

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants