drwhut / tabletop-club

An open-source platform for playing tabletop games in a physics-based 3D environment for Windows, macOS, and Linux! Made with the Godot Engine.
https://tabletopclub.net
MIT License
1.26k stars 51 forks source link

Objects menu shows errors when going through pages quickly. #216

Open GrimPixel opened 1 year ago

GrimPixel commented 1 year ago

Describe the bug The game gets frozen when there are a lot of objects. Some error messages may appear.

To Reproduce Steps to reproduce the behavior:

  1. Download https://codeberg.org/GrimPixel/Tabletop-Club-Assets and place them in the assets folder
  2. Stay at the home screen for about twenty seconds
  3. Browse “edu: the flags” in “Object”
  4. Flip the pages quickly
  5. See error

Expected behavior Nothing happens.

Screenshots ksnip_20221225-022254 ksnip_20221225-022912

Environment Arch Linux

Version v0.1.0, ...

drwhut commented 1 year ago

I managed to fix two of the issues that I could replicate (the !data.is_inside_tree() errors, and the freezing without any errors) - let me know if you still have any issues related to this.

GrimPixel commented 1 year ago

It still occurs sometimes. The frequency is much lower than before.

drwhut commented 1 year ago

Good to know - what kind of errors are you seeing now? Errors that are shown in the chat box, or the freezing, or something new?

GrimPixel commented 1 year ago

It was what the second image shows.

drwhut commented 1 year ago

Hmm... the p_elem->_root != this error never occured for me during testing. I've had a look at Godot's issues, and this particular error has cropped up a bunch of times over the years in multiple different areas, but there's still an open issue here: godotengine/godot#62970, and a closed one that looks very similar here: godotengine/godot#8691

There's one particular situation that keeps showing up in these issues, when add_child is used inside of a thread - as far as I'm aware the code never adds a node to the scene tree inside a thread (instead, I've always made sure that the nodes enter an array with a mutex, then add the node to the scene via the _process() function in the main thread), and according to the docs making a node structure outside of the scene tree in another thread is okay.

So I'm not 100% sure what's going on to cause that error - I'll try to replicate it myself, but I may need help testing.