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

Shifting a node right too rapidly via keyboard shortcut crashes the program #2409

Closed
Kumba43 opened this issue Dec 21, 2023 · 7 comments
Closed

Comments

@Kumba43
Copy link

Kumba43 commented Dec 21, 2023

Version, Operative system
App: cherrytree v1.0.3
OS: Windows Server 2022 Std 21H2 (OS Build 10.0.20348.2159)

Describe the bug
It looks like something changed with how shortcut key processing works. I will use shift+arrow keys to select/deselect text in any editor, but cherrytree has/had a shortcut bound to shift+left and shift+right that will shift a node left or right, accordingly. The issue is that these shortcuts are processed even when the keyboard focus is in the right-hand editing window, and I discovered that shifting a node right too quickly by holding down the shift key and tapping the right arrow two-to-three times will cause the program to abruptly close/crash. Workaround is to disable those specific shortcuts and restart the program.

To Reproduce

  1. Create a few nested nodes in the left-hand node tree pane
  2. Pick a nested node, then put keyboard focus into the right-hand editor pane
  3. Type a sentence or two of text, then place the input cursor before the text and try to select it by rapidly tapping shift+right arrow. If triggered, the program should suddenly close. No error dialogs or crash dialogs were observed.

Screenshots
N/A

@giuspen
Copy link
Owner

giuspen commented Dec 21, 2023

Apologies I messed up in v1.0.3 so promptly released v1.0.4. Please upgrade to v1.0.4 and confirm that it's good there.

@Kumba43
Copy link
Author

Kumba43 commented Dec 21, 2023

Apologies I messed up in v1.0.3 so promptly released v1.0.4. Please upgrade to v1.0.4 and confirm that it's good there.

It's a lot harder to get the node to shift, and selecting/deselecting text works as expected now (I restored the default shortcuts to test). However, if you rapidly shift the node left/right, it's still possible to cause the program to crash, so there's definitely a bug still lurking.

@giuspen
Copy link
Owner

giuspen commented Dec 21, 2023

Thanks @Kumba43 I'll try to reproduce the crash

@Kumba43
Copy link
Author

Kumba43 commented Dec 21, 2023

Thanks @Kumba43 I'll try to reproduce the crash

I think I got the error for you. The debug logging is some what sparse, and it turns out the bug is a LOT harder to trigger on a bare-bones file. I had to add some blobs of randomly-generated text to make it easier to reproduce. Note, I redacted my username in the log snippet:

[2023-12-21 17:23:06.968] [gtk] [critical] Class::register_derived_type(): base_query.type_name is NULL.
[2023-12-21 17:23:07.104] [ ] [debug] C:\Users[REDACTED]\AppData\Local\cherrytree\config.cfg parsed
[2023-12-21 17:23:07.674] [ ] [debug] autosave is started
[2023-12-21 17:23:09.269] [ ] [debug] shift images in MenuBar/context menu
[2023-12-21 17:23:14.380] [ ] [debug] Node name: Test1
[2023-12-21 17:23:17.789] [ ] [debug] Node name: Test4
[2023-12-21 17:23:19.565] [ ] [debug] Node name: +Test5a
[2023-12-21 17:23:39.648] [ ] [debug] Node name: +Test5b
[2023-12-21 17:23:39.666] [ ] [debug] Node name: +Test5c
[2023-12-21 17:23:39.689] [ ] [debug] Node name: +Test5b
[2023-12-21 17:23:39.694] [ ] [error] !! missing node properties for id 0
[2023-12-21 17:23:40.195] [ ] [error] !! missing node properties for id 0

It's those last two lines that seem to indicate something went wrong, as that's when the program will close/crash. I tried attaching a sample CTB file for you to test with, but there seems to be an incompatibility w/ my browser that's preventing it, as far as I can tell.

Edit: And GH's code block is obviously broken...

@giuspen
Copy link
Owner

giuspen commented Dec 23, 2023

If you zip the test .CTB file, then GitHub should allow you to attach it. In the beginning of the ticket you mentioned right-right (quickly 2 or 3 times) but then you changed to left-right, so I'm not sure what sequence I should try, can you confirm that?

@giuspen
Copy link
Owner

giuspen commented Dec 23, 2023

Nevermind I see it now, I'll investigate

@giuspen
Copy link
Owner

giuspen commented Jan 6, 2024

This has now been fixed, thanks for reporting

@giuspen giuspen closed this as completed Jan 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants