Graphite icon indicating copy to clipboard operation
Graphite copied to clipboard

Crash when Pen tool's in-progress point snaps along an angle with its previous anchor

Open Keavon opened this issue 4 months ago • 1 comments

Describe the Crash This crash happens immediately upon hoving the in-progress anchor point over the previous anchor point while snapping is enabled and angle constraint (Shift to snap 15° or Ctrl to lock angle) is active:

Steps To Reproduce Describe precisely how the crash occurred, step by step, starting with a new editor window.

  1. Ensure snapping is enabled
  2. Use the Pen tool and click to start drawing
  3. Hold Shift (Snap 15°) or Ctrl (Lock Angle)
  4. Move the pointer so the new point snaps to the already drawn anchor which the in-progress segment is coming from
  5. Immediate crash when it snaps

Additional Details

https://github.com/GraphiteEditor/Graphite/assets/4388688/6044dab6-7aa8-4a4f-a607-5eeb7223d91d

Browser and OS Chrome 122, Windows 10 or 11

Stack Trace

panicked at C:\Users\Keavon\.cargo\registry\src\index.crates.io-6f17d22bba15001f\glam-0.25.0\src\f64\dvec2.rs:478:9:
assertion failed: other_len_sq_rcp.is_finite()

Error
    at http://localhost:8080/src/io-managers/panic.ts:7:24
    at callCallback (http://localhost:8080/src/wasm-communication/subscription-router.ts:24:9)
    at Object.handleJsMessage (http://localhost:8080/src/wasm-communication/subscription-router.ts:32:5)
    at http://localhost:8080/src/wasm-communication/editor.ts?t=1710214358055:33:19
    at http://localhost:8080/wasm/pkg/graphite_wasm.js?t=1710214358055:2217:37
    at handleError (http://localhost:8080/wasm/pkg/graphite_wasm.js?t=1710214358055:375:18)
    at imports.wbg.__wbg_call_5830eb5e103aa772 (http://localhost:8080/wasm/pkg/graphite_wasm.js?t=1710214358055:2216:67)
    at js_sys::Function::call2::h0ed55ef12986170a (http://localhost:8080/wasm/pkg/graphite_wasm_bg.wasm:wasm-function[11510]:0x864b2b)
    at graphite_wasm::editor_api::JsEditorHandle::send_frontend_message_to_js::hf2e4cd2a1981ff0a (http://localhost:8080/wasm/pkg/graphite_wasm_bg.wasm:wasm-function[1730]:0x518e13)
    at std::thread::local::LocalKey<T>::with::hade82515fadb6fea (http://localhost:8080/wasm/pkg/graphite_wasm_bg.wasm:wasm-function[3360]:0x646868)
    at core::ops::function::Fn::call::h72a0b6954e26d692 (http://localhost:8080/wasm/pkg/graphite_wasm_bg.wasm:wasm-function[10168]:0x83f959)
    at std::panicking::rust_panic_with_hook::h3aa054d35a0817d7 (http://localhost:8080/wasm/pkg/graphite_wasm_bg.wasm:wasm-function[8200]:0x7eb4b7)
    at std::panicking::begin_panic_handler::{{closure}}::h2f73e4cf6cd6319a (http://localhost:8080/wasm/pkg/graphite_wasm_bg.wasm:wasm-function[9172]:0x818117)
    at std::sys_common::backtrace::__rust_end_short_backtrace::h98ac61a6abbff7e9 (http://localhost:8080/wasm/pkg/graphite_wasm_bg.wasm:wasm-function[17545]:0x89a281)
    at rust_begin_unwind (http://localhost:8080/wasm/pkg/graphite_wasm_bg.wasm:wasm-function[11250]:0x85ee55)
    at core::panicking::panic_fmt::h3e1dd3d08288569e (http://localhost:8080/wasm/pkg/graphite_wasm_bg.wasm:wasm-function[12516]:0x877afb)
    at core::panicking::panic::h0f0c05b20da93dd7 (http://localhost:8080/wasm/pkg/graphite_wasm_bg.wasm:wasm-function[12102]:0x870c4f)
    at graphite_editor::messages::tool::tool_messages::pen_tool::PenToolData::compute_snapped_angle::h7254d1ed6caec95f (http://localhost:8080/wasm/pkg/graphite_wasm_bg.wasm:wasm-function[430]:0x2964b1)
    at graphite_editor::messages::tool::tool_messages::pen_tool::PenToolData::place_anchor::hacccaf780b7971b2 (http://localhost:8080/wasm/pkg/graphite_wasm_bg.wasm:wasm-function[1461]:0x4caea0)
    at <graphite_editor::messages::tool::tool_messages::pen_tool::PenToolFsmState as graphite_editor::messages::tool::utility_types::Fsm>::transition::h0588fd582e3ef768 (http://localhost:8080/wasm/pkg/graphite_wasm_bg.wasm:wasm-function[367]:0x23a78e)
    at graphite_editor::messages::tool::utility_types::Fsm::process_event::h37aa1a299bc58843 (http://localhost:8080/wasm/pkg/graphite_wasm_bg.wasm:wasm-function[4148]:0x6a8dd4)
    at <graphite_editor::messages::tool::tool_messages::pen_tool::PenTool as graphite_editor::utility_traits::MessageHandler<graphite_editor::messages::tool::tool_message::ToolMessage,&mut graphite_editor::messages::tool::utility_types::ToolActionHandlerData>>::process_message::h81060c3ec2bd2207 (http://localhost:8080/wasm/pkg/graphite_wasm_bg.wasm:wasm-function[1958]:0x54f3b8)
    at <graphite_editor::messages::tool::tool_message_handler::ToolMessageHandler as graphite_editor::utility_traits::MessageHandler<graphite_editor::messages::tool::tool_message::ToolMessage,(&graphite_editor::messages::portfolio::document::document_message_handler::DocumentMessageHandler,graphite_editor::messages::portfolio::document::utility_types::misc::DocumentId,&graphite_editor::messages::input_preprocessor::input_preprocessor_message_handler::InputPreprocessorMessageHandler,&graphite_editor::messages::portfolio::utility_types::PersistentData,&graphite_editor::node_graph_executor::NodeGraphExecutor)>>::process_message::h7b1cc11a0a9d6e4d (http://localhost:8080/wasm/pkg/graphite_wasm_bg.wasm:wasm-function[383]:0x25558b)
    at graphite_editor::dispatcher::Dispatcher::handle_message::h1abe1b8977479f2d (http://localhost:8080/wasm/pkg/graphite_wasm_bg.wasm:wasm-function[483]:0x2d13e4)
    at graphite_editor::application::Editor::handle_message::h4ac967c04fe1ef6d (http://localhost:8080/wasm/pkg/graphite_wasm_bg.wasm:wasm-function[12720]:0x87a836)
    at std::thread::local::LocalKey<T>::with::h6a5ab5e7aaaa52e3 (http://localhost:8080/wasm/pkg/graphite_wasm_bg.wasm:wasm-function[3098]:0x62055d)
    at graphite_wasm::editor_api::JsEditorHandle::dispatch::h425f7754b09794ad (http://localhost:8080/wasm/pkg/graphite_wasm_bg.wasm:wasm-function[4836]:0x6f1188)
    at graphite_wasm::editor_api::JsEditorHandle::on_mouse_move::hc2bcdea0ac540d9c (http://localhost:8080/wasm/pkg/graphite_wasm_bg.wasm:wasm-function[8359]:0x7f3d37)
    at jseditorhandle_onMouseMove (http://localhost:8080/wasm/pkg/graphite_wasm_bg.wasm:wasm-function[10098]:0x83d32a)
    at JsEditorHandle.onMouseMove (http://localhost:8080/wasm/pkg/graphite_wasm.js?t=1710214358055:688:14)
    at onPointerMove (http://localhost:8080/src/io-managers/input.ts:101:21)
    at action (http://localhost:8080/src/io-managers/input.ts:18:64)

Keavon avatar Mar 12 '24 03:03 Keavon

submitted a PR for this issue

Sahilgill24 avatar Mar 24 '24 10:03 Sahilgill24