Fix layer deletion bugs when tools are in use (#684)

* Added test case of layer delete bug

* Fixed crash in `PenTool`

Updated the document `MessageHandler` to cancel all active tools if the
layer is deleted.  This prevents the tools from crashing due to the
layer being pulled from under them.

* Moved Abort into pre-graphene DeleteLayer message

* Renamed test case for clarity

* Moved tool crash tests to the `tools` module

* Added `test-case` to the dev dependencies

* Added crash test case for all tools

* Ran cargo fmt

Co-authored-by: otdavies <oliver@psyfer.io>
Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
Alexi
2022-06-24 09:35:07 -05:00
committed by GitHub
co-authored by otdavies Keavon Chambers
parent a4a174db04
commit 8f4cb882a9
5 changed files with 89 additions and 1 deletions
Generated
+53
View File
@@ -146,6 +146,7 @@ dependencies = [
"serde",
"serde_json",
"spin",
"test-case",
"thiserror",
]
@@ -267,6 +268,30 @@ version = "0.2.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872"
[[package]]
name = "proc-macro-error"
version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c"
dependencies = [
"proc-macro-error-attr",
"proc-macro2",
"quote",
"syn",
"version_check",
]
[[package]]
name = "proc-macro-error-attr"
version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869"
dependencies = [
"proc-macro2",
"quote",
"version_check",
]
[[package]]
name = "proc-macro2"
version = "1.0.37"
@@ -441,6 +466,28 @@ dependencies = [
"winapi-util",
]
[[package]]
name = "test-case"
version = "2.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "196e8a70562e252cc51eaaaee3ecddc39803d9b7fd4a772b7c7dae7cdf42a859"
dependencies = [
"test-case-macros",
]
[[package]]
name = "test-case-macros"
version = "2.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8dd461f47ade621665c9f4e44b20449341769911c253275dc5cb03726cbb852c"
dependencies = [
"cfg-if",
"proc-macro-error",
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "thiserror"
version = "1.0.30"
@@ -497,6 +544,12 @@ version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3"
[[package]]
name = "version_check"
version = "0.9.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
[[package]]
name = "wasm-bindgen"
version = "0.2.80"