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

Folder Location Error #2108

Closed
JueAnnLee opened this issue Nov 16, 2024 · 3 comments · Fixed by #2109
Closed

Folder Location Error #2108

JueAnnLee opened this issue Nov 16, 2024 · 3 comments · Fixed by #2109
Labels
bug Issue: Something isn't working
Milestone

Comments

@JueAnnLee
Copy link

I was adding a bunch of folders to a project, in the early stages of moving my data into nW. I was dragging folders around the tree and somehow one of those folders ended up in the root folder level of the tree, below the Trash folder. No idea how I did that; I just noticed it was in the wrong place when I was about to add a note to it.

I was able to use ctrl+up to move it near where it belonged, but it remained at root level. So, I made a new folder in the proper place, dragged the contents to that, then attempted to delete the bad folder.

I got a "Divide by Cucumber error". When I closed the error, NovelWriter crashed. When I re-opened it, my data was fine. The bad folder was now at a correct position in the tree, and I was able to delete it normally.

Contents of the error window:

Environment:
novelWriter Version: 2.5.2
Host OS: linux (6.8.0-48-generic)
Python: 3.12.3 (0x30c03f0)
Qt: 5.15.13, PyQt: 5.15.10
enchant: 3.2.2

AttributeError:
'NoneType' object has no attribute 'indexOfChild'

Traceback:
File "/usr/lib/python3/dist-packages/novelwriter/gui/projtree.py", line 1945, in
action.triggered.connect(lambda: tree.permDeleteItem(tHandle))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "/usr/lib/python3/dist-packages/novelwriter/gui/projtree.py", line 1004, in permDeleteItem
tIndex = trItemP.indexOfChild(trItemS)
^^^^^^^^^^^^^^^^^^^^

@JueAnnLee JueAnnLee added the bug Issue: Something isn't working label Nov 16, 2024
@vkbo
Copy link
Owner

vkbo commented Nov 16, 2024

Thanks for the error report.

It shouldn't be possible to drag anything onto root level, but there is a bug in some version of Qt that ignores that instruction. I've added additional code to catch it in case it does ignore it. Clearly I haven't plugged all holes. I will look into it, and also plug up the spot where it crashed when you tried to delete.

Normally, it will fix itself with a restart, like you did, since the project structure is checked for invalid entries on open.

@vkbo vkbo added this to the Release 2.5.3 milestone Nov 16, 2024
@vkbo
Copy link
Owner

vkbo commented Nov 16, 2024

By the way, could you tell me how novelWriter was installed? Are you using the Ubuntu package or the AppImage?

@vkbo
Copy link
Owner

vkbo commented Nov 16, 2024

I could reproduce your error by disabling the flag that disallows the drag and drop onto the root level. You are clearly running on one of the bugged Qt5 versions where this flag is ignored.

The fallback code blocks most moves, but if you drag an item onto the expand arrow of another item, it accepts the drop. I'll see if I can plug this hole.

This is an error that seems to be re-introduced in Qt 5.15 multiple times. It is also buggy between. 5.15.3 and 5.15.8 somewhere. Hopefully when novelWriter moves to Qt6, this will be resolved. There are multiple bugs in the tree widget related to drag and drop, and they all seem to come and go in random versions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue: Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants