### Godot version

v4.0.beta11.official [91713ced8]

### System information

Windows 10

### Issue description

Resizing a PackedByteArray will immediately crash.

```
Godot Engine v4.0.beta.custom_build.91713ced8 - https://godotengine.org
Vulkan API 1.3.224 - Using Vulkan Device #0: NVIDIA - NVIDIA GeForce RTX 3090


================================================================
CrashHandlerException: Program crashed
Engine version: Godot Engine v4.0.beta.custom_build (91713ced81792b10fdc9367b7f355738e5d52777)
Dumping the backtrace. Please include this when reporting the bug on: https://github.com/godotengine/godot/issues
[0] std::_Atomic_storage<unsigned int,4>::load (C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\)
[1] std::_Atomic_storage<unsigned int,4>::load (C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\)
[2] SafeNumeric<unsigned int>::get (C:\Users\Chris\Development\godot\godot\core\templates\safe_refcount.h:72)
[3] SafeRefCount::_check_unref_sanity (C:\Users\Chris\Development\godot\godot\core\templates\safe_refcount.h:173)
[4] SafeRefCount::unref (C:\Users\Chris\Development\godot\godot\core\templates\safe_refcount.h:193)
[5] Variant::PackedArrayRefBase::destroy (C:\Users\Chris\Development\godot\godot\core\variant\variant.h:199)
[6] Variant::_clear_internal (C:\Users\Chris\Development\godot\godot\core\variant\variant.cpp:1382)
[7] Variant::clear (C:\Users\Chris\Development\godot\godot\core\variant\variant.h:304)
[8] Variant::~Variant (C:\Users\Chris\Development\godot\godot\core\variant\variant.h:778)
[9] Variant::`scalar deleting destructor'
[10] GDScriptFunction::call (C:\Users\Chris\Development\godot\godot\modules\gdscript\gdscript_vm.cpp:3541)
[11] GDScriptInstance::callp (C:\Users\Chris\Development\godot\godot\modules\gdscript\gdscript.cpp:1847)
[12] Object::callp (C:\Users\Chris\Development\godot\godot\core\object\object.cpp:711)
[13] Variant::callp (C:\Users\Chris\Development\godot\godot\core\variant\variant_call.cpp:1161)
[14] GDScriptFunction::call (C:\Users\Chris\Development\godot\godot\modules\gdscript\gdscript_vm.cpp:1551)
[15] GDScriptInstance::callp (C:\Users\Chris\Development\godot\godot\modules\gdscript\gdscript.cpp:1847)
[16] Object::callp (C:\Users\Chris\Development\godot\godot\core\object\object.cpp:711)
[17] Variant::callp (C:\Users\Chris\Development\godot\godot\core\variant\variant_call.cpp:1161)
[18] GDScriptFunction::call (C:\Users\Chris\Development\godot\godot\modules\gdscript\gdscript_vm.cpp:1583)
[19] GDScriptInstance::callp (C:\Users\Chris\Development\godot\godot\modules\gdscript\gdscript.cpp:1847)
[20] Node::_gdvirtual__ready_call<0> (C:\Users\Chris\Development\godot\godot\scene\main\node.h:242)
[21] Node::_notification (C:\Users\Chris\Development\godot\godot\scene\main\node.cpp:156)
[22] Node::_notificationv (C:\Users\Chris\Development\godot\godot\scene\main\node.h:46)
[23] Object::notification (C:\Users\Chris\Development\godot\godot\core\object\object.cpp:792)
[24] Node::_propagate_ready (C:\Users\Chris\Development\godot\godot\scene\main\node.cpp:189)
[25] Node::_propagate_ready (C:\Users\Chris\Development\godot\godot\scene\main\node.cpp:181)
[26] Node::_set_tree (C:\Users\Chris\Development\godot\godot\scene\main\node.cpp:2595)
[27] SceneTree::initialize (C:\Users\Chris\Development\godot\godot\scene\main\scene_tree.cpp:411)
[28] OS_Windows::run (C:\Users\Chris\Development\godot\godot\platform\windows\os_windows.cpp:1275)
[29] widechar_main (C:\Users\Chris\Development\godot\godot\platform\windows\godot_windows.cpp:181)
[30] _main (C:\Users\Chris\Development\godot\godot\platform\windows\godot_windows.cpp:203)
[31] main (C:\Users\Chris\Development\godot\godot\platform\windows\godot_windows.cpp:217)
[32] WinMain (C:\Users\Chris\Development\godot\godot\platform\windows\godot_windows.cpp:231)
[33] __scrt_common_main_seh (D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288)
[34] <couldn't map PC to fn name>
-- END OF BACKTRACE --
================================================================
```

### Steps to reproduce

```gdscript
var pba: PackedByteArray = PackedByteArray()
pba.resize(4)
```

### Minimal reproduction project

[byte-array.zip](https://github.com/godotengine/godot/files/10386136/byte-array.zip)

virtual void write_construct_array(const Address &p_target, const Vector<Address> &p_arguments) override;
	virtual void write_construct_typed_array(const Address &p_target, const GDScriptDataType &p_element_type, const Vector<Address> &p_arguments) override;
	virtual void write_construct_dictionary(const Address &p_target, const Vector<Address> &p_arguments) override;
	virtual void write_await(const Address &p_target, const Address &p_operand) override;
	virtual void write_if(const Address &p_condition) override;
	virtual void write_else() override;
	virtual void write_endif() override;
	virtual void write_jump_if_shared(const Address &p_value) override;
	virtual void write_end_jump_if_shared() override;
	virtual void start_for(const GDScriptDataType &p_iterator_type, const GDScriptDataType &p_list_type) override;
	virtual void write_for_assignment(const Address &p_variable, const Address &p_list) override;
	virtual void write_for() override;
	virtual void write_endfor() override;
	virtual void start_while_condition() override;
	virtual void write_while(const Address &p_condition) override;
	virtual void write_endwhile() override;
	virtual void start_match() override;
	virtual void start_match_branch() override;
	virtual void end_match() override;
	virtual void write_break() override;
	virtual void write_continue() override;
	virtual void write_continue_match() override;
	virtual void write_breakpoint() override;
	virtual void write_newline(int p_line) override;
	virtual void write_return(const Address &p_return_value) override;
	virtual void write_assert(const Address &p_test, const Address &p_message) override;
	virtual ~GDScriptByteCodeGenerator();
};
#endif