Repository: godotengine/godot (language: cpp)

Issue:
CameraServer error is printed on startup when opening the editor
### Tested versions

- Reproducible in: 4.5.dev 2303ce843
- Not reproducible in: 4.4.stable

### System information

Godot v4.5.dev (2303ce843) - Fedora Linux 41 (KDE Plasma) on X11 - X11 display driver, Multi-window, 1 monitor - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 4090 (nvidia; 570.133.07) - 13th Gen Intel(R) Core(TM) i9-13900K (32 threads)

### Issue description

A CameraServer error is printed on startup when opening the editor:

```
ERROR: CameraServer is not actively monitoring feeds; call set_monitoring_feeds(true) first.
   at: get_feed_by_id (servers/camera_server.cpp:103)
```

It's printed most of the time, but not every time. If I create a new project, I'll keep seeing it when opening the project when it has no main scene defined, but as soon as it has a main scene defined and I run it, it no longer appears when reopening the editor.

This is likely a regression from https://github.com/godotengine/godot/pull/104232. cc @Ivorforce 

### Steps to reproduce

- Create a new project and open it. The error message should appear in the Output bottom panel.

### Minimal reproduction project (MRP)

N/A


Discussion / hints:
I was able to reproduce this 2 times, but since then I tried it with various combinations and had no luck since.
A search through the codebase reveals only `rasterizer_scene_gles3.cpp` as a possible caller of `CameraServer` (unless I missed one). Possibly it's a race condition, calling `render_scene` with `bg_mode` as garbage data?
Edit: I caught it, the trick is to open the same project with two different builds in succession (for me anyway). Backtrace:
```
  * frame #0: 0x0000000103e2a35c godot.macos.editor.arm64`CameraServer::get_feed_by_id(this=0x000000014c8f7350, p_id=0) at camera_server.cpp:103:2 [opt]
    frame #1: 0x00000001038b6cd8 godot.macos.editor.arm64`CameraTexture::get_camera_active(this=0x000000012bbe26f0) const at camera_texture.cpp:136:56 [opt]
    frame #2: 0x0000000100cd5c34 godot.macos.editor.arm64`void call_with_variant_args_ret_dv<__UnexistingClass, bool>(__UnexistingClass*, bool (__UnexistingClass::*)(), Variant const**, int, Variant&, Callable::CallError&, Vector<Variant> const&) [inlined] void call_with_variant_args_ret_helper<__UnexistingClass, bool>(p_instance=<unavailable>, p_method=<unavailable>, p_args=<unavailable>, r_ret=0x000000016fdfd9f0, r_error=<unavailable>, (null)=<unavailable>) at binder_common.h:766:10 [opt]
    frame #3: 0x0000000100cd5c14 godot.macos.editor.arm64`void call_with_variant_args_ret_dv<__UnexistingClass, bool>(p_instance=0x000000012bbe26f0, p_method=<unavailable>, p_args=<unavailable>, p_argcount=<unavailable>, r_ret=0x000000016fdfd9f0, r_error=<unavailable>, default_values=<unavailable>) at binder_common.h:545:2 [opt]
    frame #4: 0x0000000100d7f9cc godot.macos.editor.arm64`MethodBindTRC<bool>::call(this=0x000060000111ad10, p_object=0x000000012bbe26f0, p_args=0x0000000000000000, p_arg_count=0, r_error=0x000000016fdfd9b8) const at method_bind.h:618:3 [opt]
    frame #5: 0x0000000104ddcf70 godot.macos.editor.arm64`ClassDB::get_property(p_object=0x000000012bbe26f0, p_property=<unavailable>, r_value=0x000000016fdfda70) at class_db.cpp:1674:30 [opt]
    frame #6: 0x0000000104dec5b0 godot.macos.editor.arm64`Object::get(this=0x000000012bbe26f0, p_name=0x000000016fdfdaf8, r_valid=0x0000000000000000) const at object.cpp:372:7 [opt]
    frame #7: 0x0000000104de1680 godot.macos.editor.arm64`ClassDB::class_get_default_property_value(p_class=0x000060000adaee60, p_property=0x000000016fdfe5a8, r_valid=0x000000016fdfe5a0) at class_db.cpp:2205:22 [opt]
    frame #8: 0x0000000102069fe0 godot.macos.editor.arm64`get_documentation_default_value(p_class_name=0x000000016fdfe5e0, p_property_name=0x000000016fdfe5a8, r_default_value_valid=0x000000016fdfe5a0) at doc_tools.cpp:399:21 [opt]
    frame #9: 0x00000001020631a0 godot.macos.editor.arm64`DocTools::generate(this=0x000060000130ec10, p_flags=<unavailable>) at doc_tools.cpp:554:36 [opt]
    frame #10: 0x00000001021519fc godot.macos.editor.arm64`EditorHelp::generate_doc(p_use_cache=<unavailable>, p_use_script_cache=true) at editor_help.cpp:3195:8 [opt]
    frame #11: 0x0000000104de8574 godot.macos.editor.arm64`CallQueue::_call_function(this=<unavailable>, p_callable=0x00000001201dc550, p_args=0x00000001201dc568, p_argcount=2, p_show_error=true) at message_queue.cpp:220:13 [opt]
    frame #12: 0x0000000104de8844 godot.macos.editor.arm64`CallQueue::flush(this=0x0000600000fd3530) at message_queue.cpp:268:6 [opt]
    frame #13: 0x0000000102ef0ba4 godot.macos.editor.arm64`SceneTree::physics_process(this=0x000000014e283810, p_time=0.016666666666666666) at scene_tree.cpp:534:33 [opt]
    frame #14: 0x0000000100418d20 godot.macos.editor.arm64`Main::iteration() at main.cpp:4561:45 [opt]
    frame #15: 0x00000001003a8870 godot.macos.editor.arm64`OS_MacOS::run(this=0x000000016fdfeba8) at os_macos.mm:843:9 [opt]
    frame #16: 0x00000001003d5fe8 godot.macos.editor.arm64`main(argc=<unavailable>, argv=<unavailable>) at godot_main_macos.mm:84:6 [opt]
```

Fix patch:
diff --git a/scene/resources/camera_texture.cpp b/scene/resources/camera_texture.cpp
index b219f89e5983..2e0175b2f49f 100644
--- a/scene/resources/camera_texture.cpp
+++ b/scene/resources/camera_texture.cpp
@@ -45,6 +45,7 @@ void CameraTexture::_bind_methods() {
 	ADD_PROPERTY(PropertyInfo(Variant::INT, "camera_feed_id"), "set_camera_feed_id", "get_camera_feed_id");
 	ADD_PROPERTY(PropertyInfo(Variant::INT, "which_feed"), "set_which_feed", "get_which_feed");
 	ADD_PROPERTY(PropertyInfo(Variant::BOOL, "camera_is_active"), "set_camera_active", "get_camera_active");
+	ADD_PROPERTY_DEFAULT("camera_is_active", false);
 }
 
 void CameraTexture::_on_format_changed() {


Test patch: