From 944c7e26038ff82c4666fa2c3814c612ef576761 Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Mon, 13 Jun 2016 22:24:11 -0300 Subject: [PATCH] fix crash when clearing dynamicfontdata, closes #4877 --- scene/gui/control.cpp | 2 +- scene/resources/dynamic_font.cpp | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp index b122ab4183e..666ac88055f 100644 --- a/scene/gui/control.cpp +++ b/scene/gui/control.cpp @@ -1844,7 +1844,7 @@ void Control::_propagate_theme_changed(CanvasItem *p_at,Control *p_owner) { Control *c = p_at->cast_to(); - if (c && c->data.theme.is_valid()) // has a theme, this can't be propagated + if (c && c!=p_owner && c->data.theme.is_valid()) // has a theme, this can't be propagated return; for(int i=0;iget_child_count();i++) { diff --git a/scene/resources/dynamic_font.cpp b/scene/resources/dynamic_font.cpp index 78a5571bf05..1edae01754a 100644 --- a/scene/resources/dynamic_font.cpp +++ b/scene/resources/dynamic_font.cpp @@ -573,7 +573,11 @@ DynamicFontAtSize::~DynamicFontAtSize(){ void DynamicFont::set_font_data(const Ref& p_data) { data=p_data; - data_at_size=data->_get_dynamic_font_at_size(size); + if (data.is_valid()) + data_at_size=data->_get_dynamic_font_at_size(size); + else + data_at_size=Ref(); + emit_changed(); }