Warn of invalid pointer when converting object to RID, closes #19023
This commit is contained in:
parent
b203f80dfc
commit
c2f59de212
2 changed files with 13 additions and 7 deletions
|
@ -1731,6 +1731,14 @@ Variant::operator RID() const {
|
||||||
else if (type == OBJECT && !_get_obj().ref.is_null()) {
|
else if (type == OBJECT && !_get_obj().ref.is_null()) {
|
||||||
return _get_obj().ref.get_rid();
|
return _get_obj().ref.get_rid();
|
||||||
} else if (type == OBJECT && _get_obj().obj) {
|
} else if (type == OBJECT && _get_obj().obj) {
|
||||||
|
#ifdef DEBUG_ENABLED
|
||||||
|
if (ScriptDebugger::get_singleton()) {
|
||||||
|
if (!ObjectDB::instance_validate(_get_obj().obj)) {
|
||||||
|
ERR_EXPLAIN("Invalid pointer (object was deleted)");
|
||||||
|
ERR_FAIL_V(RID());
|
||||||
|
};
|
||||||
|
};
|
||||||
|
#endif
|
||||||
Variant::CallError ce;
|
Variant::CallError ce;
|
||||||
Variant ret = _get_obj().obj->call(CoreStringNames::get_singleton()->get_rid, NULL, 0, ce);
|
Variant ret = _get_obj().obj->call(CoreStringNames::get_singleton()->get_rid, NULL, 0, ce);
|
||||||
if (ce.error == Variant::CallError::CALL_OK && ret.get_type() == Variant::_RID) {
|
if (ce.error == Variant::CallError::CALL_OK && ret.get_type() == Variant::_RID) {
|
||||||
|
|
|
@ -1941,12 +1941,11 @@ void SceneTree::add_idle_callback(IdleCallback p_callback) {
|
||||||
|
|
||||||
void SceneTree::set_use_font_oversampling(bool p_oversampling) {
|
void SceneTree::set_use_font_oversampling(bool p_oversampling) {
|
||||||
|
|
||||||
|
if (use_font_oversampling == p_oversampling)
|
||||||
|
return;
|
||||||
|
|
||||||
use_font_oversampling = p_oversampling;
|
use_font_oversampling = p_oversampling;
|
||||||
if (use_font_oversampling) {
|
_update_root_rect();
|
||||||
DynamicFontAtSize::font_oversampling = OS::get_singleton()->get_window_size().width / root->get_visible_rect().size.width;
|
|
||||||
} else {
|
|
||||||
DynamicFontAtSize::font_oversampling = 1.0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SceneTree::is_using_font_oversampling() const {
|
bool SceneTree::is_using_font_oversampling() const {
|
||||||
|
@ -1960,6 +1959,7 @@ SceneTree::SceneTree() {
|
||||||
accept_quit = true;
|
accept_quit = true;
|
||||||
quit_on_go_back = true;
|
quit_on_go_back = true;
|
||||||
initialized = false;
|
initialized = false;
|
||||||
|
use_font_oversampling = false;
|
||||||
#ifdef DEBUG_ENABLED
|
#ifdef DEBUG_ENABLED
|
||||||
debug_collisions_hint = false;
|
debug_collisions_hint = false;
|
||||||
debug_navigation_hint = false;
|
debug_navigation_hint = false;
|
||||||
|
@ -2095,8 +2095,6 @@ SceneTree::SceneTree() {
|
||||||
live_edit_root = NodePath("/root");
|
live_edit_root = NodePath("/root");
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
use_font_oversampling = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SceneTree::~SceneTree() {
|
SceneTree::~SceneTree() {
|
||||||
|
|
Loading…
Reference in a new issue