mirror of
https://github.com/aseprite/aseprite.git
synced 2025-04-07 10:21:30 +00:00
Fix crash accessing theme dimensions/info in a plugin's init() function (fix #3913)
This commit is contained in:
parent
b0b2fb378e
commit
9db01bf82f
@ -49,12 +49,12 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct ThemeDimension {
|
struct ThemeDimension {
|
||||||
Theme* theme;
|
const Theme theme;
|
||||||
|
|
||||||
ThemeDimension(Theme* theme) : theme(theme) { }
|
ThemeDimension(const Theme& theme) : theme(theme) { }
|
||||||
|
|
||||||
int getById(const std::string& id) const {
|
int getById(const std::string& id) const {
|
||||||
return theme->getDimensionById(id);
|
return theme.getDimensionById(id);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -129,7 +129,7 @@ int Theme_styleMetrics(lua_State* L)
|
|||||||
int Theme_get_dimension(lua_State* L)
|
int Theme_get_dimension(lua_State* L)
|
||||||
{
|
{
|
||||||
auto theme = get_obj<Theme>(L, 1);
|
auto theme = get_obj<Theme>(L, 1);
|
||||||
push_new<ThemeDimension>(L, theme);
|
push_new<ThemeDimension>(L, *theme);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user