kosenko / ui

Boost.UI library
266 stars 18 forks source link

label.font() causes crash #3

Closed mohd-akram closed 5 years ago

mohd-akram commented 5 years ago

This program causes a crash on macOS High Sierra:

#include <boost/ui.hpp>

namespace ui = boost::ui;

int ui_main()
{
    ui::label label;
    label.font();
    return 0;
}

int main(int argc, char* argv[])
{
    return ui::entry(&ui_main, argc, argv);
}

Error:

libs/ui/src/widget.cpp(304): assert "impl" failed in font().

Call stack:
[00] ui_main()                               
[01] boost_ui_app::OnRunHere(int&)              application.cpp:0
[02] (anonymous namespace)::safe_call(boost::function<void ()> const&, char const*)     application.cpp:15
[03] boost_ui_app::OnRun()                      function_template.hpp:87
[04] wxEntry(int&, wchar_t**)                
[05] boost::ui::entry(int (*)(), int, char**)   application.cpp:31
[06] main                                    
[07] start                                   
[08] 0x00000001
kosenko commented 5 years ago

It is an assertion failure. Label widget should be created to have properties like font:

#include <boost/ui.hpp>

namespace ui = boost::ui;

int ui_main()
{
    ui::dialog dlg("Title");
    ui::label label(dlg);
    ui::info_dialog(label.font().name());
    return 0;
}

int main(int argc, char* argv[])
{
    return ui::entry(&ui_main, argc, argv);
}
mohd-akram commented 5 years ago

Thank you for the quick reply, and for this library!