Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pango layout problem with 1.16 branch on MSVC+cmake builds #7217

Closed
Wedge009 opened this issue Dec 19, 2022 · 7 comments
Closed

pango layout problem with 1.16 branch on MSVC+cmake builds #7217

Wedge009 opened this issue Dec 19, 2022 · 7 comments
Labels
Bug Issues involving unexpected behavior. Building Build-time issues. Confirmed Issues that have been successfully reproduced by at least one developer. Stable 1.16 Issues specific to the Wesnoth 1.16 maintenance branch. Windows OS-specific issues that apply to Microsoft Windows

Comments

@Wedge009
Copy link
Member

Game and System Information

  • Version: 1.16
  • Downloaded from: GitHub
  • Build info: MSVC + cmake
  • OS: Windows 7 + 10

Description of the bug

Been having a run of bad luck with building/running 1.16 on Windows. I was still using manual VC project files with MSVC for 1.16 branch until very recently. In my set-up some dependencies I built myself (eg OpenSSL), others I downloaded pre-built (eg SDL), others still I just used via vcpkg. This might sound like a horrible mix-up but it was working for me till recently.

pango is one of the dependencies I used from vcpkg. But I got to a point where the built binaries just wouldn't reach the main menu screen. Eventually I found it was a pango layout issue, resulting in the log file message:

User message: Failed to show a dialog, which doesn't fit on the screen.
Dev message: ...\src\gui\widgets\window.cpp:945 - in function 'gui2::window::layout' found the following problem: Failed to size window, wanted size 940x1916560 available size 1600,900 screen size 1600,900.

Giving up on it once I found the issue was in pango, I switched to full vcpkg build via cmake which resulted in missing images due to SDL being unable to load images for some reason (discussed in #wesnoth-dev). Eventually the vcpkg baseline was updated and I am now at the point where I was to begin with - ie pango layout failing with vcpkg builds.

Steps to reproduce the behavior

  1. Switch to 1.16 branch
  2. Compile with MSVC + cmake
  3. Attempt to run Wesnoth
  4. Observe start-up screen shows squares instead of normal printable characters and subsequently crashes before reaching the main menu screen.

Expected behavior

Normal execution through to the main menu screen.

Additional context

master branch builds fine, as do all builds on Linux.

@Wedge009 Wedge009 added Bug Issues involving unexpected behavior. Windows OS-specific issues that apply to Microsoft Windows Building Build-time issues. Stable 1.16 Issues specific to the Wesnoth 1.16 maintenance branch. labels Dec 19, 2022
@Wedge009
Copy link
Member Author

1 16

@stevecotton
Copy link
Contributor

What language is it using? Does it still happen in en_US?

Please check in your preferences file first, because if you just override it with --language then we may lose one of the reproduction steps for the bug.

@Wedge009
Copy link
Member Author

Wedge009 commented Dec 19, 2022

Removing preferences doesn't appear to make a difference. I checked that previously and I reconfirmed just now.

From my previous debugging efforts, the call in question is pango_layout_get_pixel_extents:

wesnoth/src/font/text.cpp

Lines 564 to 567 in 47fa4fa

pango_layout_set_width(&layout, maximum_width == -1
? -1
: maximum_width * PANGO_SCALE);
pango_layout_get_pixel_extents(&layout, nullptr, &size);

Eventually size is returned with an unreasonably large height, and it doesn't appear to be consistent, but it's of the order of a million or two. I don't know if that means there's a memory issue somewhere, or just vcpkg not configuring pango properly.

@Wedge009
Copy link
Member Author

Call stack, running against 47fa4fa:

wesnoth.exe!font::pango_text::calculate_size(_PangoLayout & layout) Line 569	C++
wesnoth.exe!font::pango_text::recalculate() Line 520	C++
wesnoth.exe!font::pango_text::is_truncated() Line 129	C++
wesnoth.exe!gui2::styled_widget::get_best_text_size(point minimum_size, point maximum_size) Line 504	C++
wesnoth.exe!gui2::styled_widget::calculate_best_size() Line 260	C++
wesnoth.exe!gui2::widget::get_best_size() Line 199	C++
wesnoth.exe!gui2::grid::child::get_best_size() Line 758	C++
wesnoth.exe!gui2::grid::calculate_best_size() Line 439	C++
wesnoth.exe!gui2::widget::get_best_size() Line 199	C++
wesnoth.exe!gui2::policy::placement::independent::calculate_best_size() Line 923	C++
wesnoth.exe!gui2::generator<gui2::policy::minimum_selection::one_item,gui2::policy::maximum_selection::one_item,gui2::policy::placement::independent,gui2::policy::select_action::show>::calculate_best_size() Line 802	C++
wesnoth.exe!gui2::widget::get_best_size() Line 199	C++
wesnoth.exe!gui2::grid::child::get_best_size() Line 758	C++
wesnoth.exe!gui2::grid::calculate_best_size() Line 439	C++
wesnoth.exe!gui2::widget::get_best_size() Line 199	C++
wesnoth.exe!gui2::container_base::calculate_best_size() Line 154	C++
wesnoth.exe!gui2::widget::get_best_size() Line 199	C++
wesnoth.exe!gui2::grid::child::get_best_size() Line 758	C++
wesnoth.exe!gui2::grid::calculate_best_size() Line 439	C++
wesnoth.exe!gui2::widget::get_best_size() Line 199	C++
wesnoth.exe!gui2::container_base::calculate_best_size() Line 154	C++
wesnoth.exe!gui2::widget::get_best_size() Line 199	C++
wesnoth.exe!gui2::grid::child::get_best_size() Line 758	C++
wesnoth.exe!gui2::grid::calculate_best_size() Line 439	C++
wesnoth.exe!gui2::widget::get_best_size() Line 199	C++
wesnoth.exe!gui2::policy::placement::independent::calculate_best_size() Line 923	C++
wesnoth.exe!gui2::generator<gui2::policy::minimum_selection::no_item,gui2::policy::maximum_selection::many_items,gui2::policy::placement::independent,gui2::policy::select_action::show>::calculate_best_size() Line 802	C++
wesnoth.exe!gui2::widget::get_best_size() Line 199	C++
wesnoth.exe!gui2::grid::child::get_best_size() Line 758	C++
wesnoth.exe!gui2::grid::calculate_best_size() Line 439	C++
wesnoth.exe!gui2::widget::get_best_size() Line 199	C++
wesnoth.exe!gui2::container_base::calculate_best_size() Line 154	C++
wesnoth.exe!gui2::widget::get_best_size() Line 199	C++
wesnoth.exe!gui2::grid::child::get_best_size() Line 758	C++
wesnoth.exe!gui2::grid::calculate_best_size() Line 439	C++
wesnoth.exe!gui2::widget::get_best_size() Line 199	C++
wesnoth.exe!gui2::container_base::calculate_best_size() Line 154	C++
wesnoth.exe!gui2::widget::get_best_size() Line 199	C++
wesnoth.exe!gui2::window::layout() Line 884	C++
wesnoth.exe!gui2::window::draw() Line 624	C++
[External Code]	
wesnoth.exe!gui2::event::implementation::fire_event<std::function<void __cdecl(gui2::widget &,enum gui2::event::ui_event,bool &,bool &)>>(const gui2::event::ui_event event, std::vector<std::pair<gui2::widget *,enum gui2::event::ui_event>,std::allocator<std::pair<gui2::widget *,enum gui2::event::ui_event>>> & event_chain, gui2::widget * dispatcher, gui2::widget * w) Line 319	C++
wesnoth.exe!gui2::event::fire_event<std::function<void __cdecl(gui2::widget &,enum gui2::event::ui_event,bool &,bool &)>>(const gui2::event::ui_event event, gui2::event::dispatcher * d, gui2::widget * w) Line 388	C++
wesnoth.exe!gui2::event::dispatcher::fire(const gui2::event::ui_event event, gui2::widget & target) Line 88	C++
wesnoth.exe!gui2::event::sdl_event_handler::draw() Line 598	C++
wesnoth.exe!gui2::event::sdl_event_handler::draw_everything() Line 612	C++
wesnoth.exe!gui2::event::sdl_event_handler::handle_event(const SDL_Event & event) Line 426	C++
wesnoth.exe!events::pump() Line 695	C++
wesnoth.exe!gui2::window::show(const bool restore, const unsigned int auto_close_timeout) Line 543	C++
wesnoth.exe!gui2::dialogs::modal_dialog::show(const unsigned int auto_close_time) Line 90	C++
wesnoth.exe!do_gameloop(const std::vector<std::string,std::allocator<std::string>> & args) Line 919	C++
wesnoth.exe!SDL_main(int argc, char * * argv) Line 1113	C++
wesnoth.exe!main_getcmdline() Line 82	C
wesnoth.exe!WinMain(HINSTANCE__ * hInst, HINSTANCE__ * hPrev, char * szCmdLine, int sw) Line 115	C

There's no error thrown here, this is just the point at which I find size.height is first calculated to be ridiculously large.

@Wedge009
Copy link
Member Author

@Vultraz Reconfirmed just now, 1.16 @ 23a575d, vcpkg @ 6adca01a3fadca0cc0b80f03ec57c7c3a0be5c02.

@Wedge009 Wedge009 added the Confirmed Issues that have been successfully reproduced by at least one developer. label Dec 24, 2022
Wedge009 added a commit to Wedge009/wesnoth that referenced this issue Jul 14, 2023
This updates to pango 1.50.14 (from 1.50.12) which resolves wesnoth#7217 (but introduces wesnoth#7543).
Wedge009 added a commit that referenced this issue Jul 14, 2023
This updates to pango 1.50.14 (from 1.50.12) which resolves #7217 (but introduces #7543).
@Wedge009
Copy link
Member Author

Closed with #7793.

@Wedge009
Copy link
Member Author

Confirming this issue was caused by vcpkg's build of Pango 1.50.12.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Issues involving unexpected behavior. Building Build-time issues. Confirmed Issues that have been successfully reproduced by at least one developer. Stable 1.16 Issues specific to the Wesnoth 1.16 maintenance branch. Windows OS-specific issues that apply to Microsoft Windows
Projects
None yet
Development

No branches or pull requests

2 participants