Repository: godot
Issue: Crashes don't show up in the editor's console log
Labels: bug,topic:core,needs testing,crash

### Context
This issue was updated to be more accurate after some discussion in the comments.
**Original title:** Object.call_deferred crashes without an error after being called too many times

I was reporting what I thought was unintended behavior regarding `Object.call_deffered()`, however, it turns out that the queue used for this method was running out of memory because of a limit set by Godot, which can be modified in project settings. The actual problem was that the crash does not show up in the editor's console. I wasn't able to find any duplicate issues, so I decided to update this one.

### Tested versions

- **Reproducible in:** 4.2.1 Stable (x64, .NET), 4.3-dev5 (x64, .NET)
- **Doesn't run:** 4.0 Stable (x64, .NET), 4.1.3 Stable (x64, .NET)

Both of these versions didn't run because of the following error, which showed up 12 times in the console:
```
E 0:00:02:0451   mesh_add_surface: Meshes must contain a vertex array, an index array, or both
<C++ Error>    Condition "!p_surface.index_count && !p_surface.vertex_count" is true.
<C++ Source>   servers/rendering/renderer_rd/storage_rd/mesh_storage.cpp:388 @ mesh_add_surface()
```



### System information

Godot v4.2.1.stable.mono - Windows 10.0.22631 - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 3070 (NVIDIA; 31.0.15.5186) - AMD Ryzen 9 5900X 12-Core Processor (24 Threads)

### Issue description

I made a maze generation program which worked flawlessly until I tried to add multithreading to it. Then, I noticed that `Object.call_deferred()` was causing a crash without an error output when generating larger mazes, regardless if multithreading was being used. I'd expect `Object.call_deferred()` to either not crash, or output an error while doing so.

**GDScript Example:**
The program works fine (sometimes it crashes regardless) with a maze size of 600 by 600, but when increased to 601 by 601, the program crashes. When the deferred and the multithreading variables are disabled, the script is able to generate much larger mazes.

https://github.com/godotengine/godot/assets/101441443/32deabe6-dd0e-477d-8d09-682953b4de4a

**C# Example:**
The situation is exactly the same, but the C# limit is lower, at 559 by 559, and crashing at higher values, however, it exhibits much more consistency in its behavior.

https://github.com/godotengine/godot/assets/101441443/d1b2442a-afe8-487c-9b68-375d58d6ca10

### Steps to reproduce

1. Open the project
2. Select the `MazeGen` object in the editor
	**You may change the script from `MazeGen.gd` to `MazeGen.cs` to test C#**
3. Set the Size property to its default value (max value which won't crash), then run the project
4. Increase the Size property and re-run the project (now it crashes)
5. Disable Multithreading, then re-run the project (still crashes)
6. Disable Deferred, then re-run the project (now it works fine)

**Note:** The mouse is captured by default. Press ESC to release it, and left click to recapture it.

### Minimal reproduction project (MRP)

[Maze MRP.zip](https://github.com/godotengine/godot/files/14813790/Maze.MRP.zip)