@@ -168,9 +168,10 @@ void mb_shell::menu_item_normal_widget::render(ui::nanovg_context ctx) {
168168 auto icon_unfold = fmt::format (
169169 R"#( <svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 12 12"><path opacity="0.7" fill="{}" d="M4.646 2.146a.5.5 0 0 0 0 .708L7.793 6L4.646 9.146a.5.5 0 1 0 .708.708l3.5-3.5a.5.5 0 0 0 0-.708l-3.5-3.5a.5.5 0 0 0-.708 0"/></svg>)#" ,
170170 c ? " white" : " black" );
171- auto icon_unfold_img_svg = nsvgParse (icon_unfold.data (), " px" , 96 );
171+ ui::nanovg_context::NSVGimageRAII icon_unfold_img_svg (
172+ nsvgParse (icon_unfold.data (), " px" , 96 ));
172173 this ->icon_unfold_img =
173- ctx.imageFromSVG (icon_unfold_img_svg, ctx.rt ->dpi_scale );
174+ ctx.imageFromSVG (icon_unfold_img_svg. image , ctx.rt ->dpi_scale );
174175 }
175176
176177 auto paintY = floor (*y + (*height - icon_width) / 2 );
@@ -997,8 +998,9 @@ void mb_shell::menu_item_normal_widget::reload_icon_img(
997998 icon_img = ui::LoadBitmapImage (ctx, (HBITMAP)item.icon_bitmap .value ());
998999 else if (item.icon_svg ) {
9991000 std::string copy = item.icon_svg .value ();
1000- auto svg = nsvgParse (copy.data (), " px" , 96 );
1001- icon_img = ctx.imageFromSVG (svg, ctx.rt ->dpi_scale );
1001+ ui::nanovg_context::NSVGimageRAII svg (
1002+ nsvgParse (copy.data (), " px" , 96 ));
1003+ icon_img = ctx.imageFromSVG (svg.image , ctx.rt ->dpi_scale );
10021004 } else {
10031005 icon_img = std::nullopt ;
10041006 }
@@ -1232,7 +1234,9 @@ void mb_shell::screenside_button_group_widget::button_widget::render(
12321234
12331235 float icon_size = std::min (*width, *height) - 8 .f ;
12341236 if (!icon) {
1235- icon = ctx.imageFromSVG (nsvgParse (icon_svg.data (), " px" , 96 ));
1237+ ui::nanovg_context::NSVGimageRAII svg (
1238+ nsvgParse (icon_svg.data (), " px" , 96 ));
1239+ icon = ctx.imageFromSVG (svg.image );
12361240 }
12371241
12381242 if (icon) {
0 commit comments