displaying tooltips in fullscreen causes crash

Bug #1137765 reported by Fredrik Jansson
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
widelands
Fix Released
High
Unassigned

Bug Description

I reliably get a segmentation fault when (just before) a tooltip is displayed in fullscreen mode.

Steps to reproduce:
start widelands
go to options
set fullscreen mode, apply
go to options again
hover over any of the ++ or -- buttons which display a tooltip
->Crasch.

I have Widelands bzr6518, which I compiled myself. The problem occurs both on a 64 bit, up-to-date debian Wheezy and
a 32 bit Ubuntu 11.10.

When I compile in debug mode, and run in gdb, the crash occurs here (full output is in the attachment):
...
SurfaceCache: inserted pics/list_selected.png, now using 12.49 mb.
SurfaceCache: inserted pics/optionsmenu.jpg:1600:1200, now using 19.81 mb.

Program received signal SIGSEGV, Segmentation fault.
0x000000000060b265 in UI::Font_Handler1::render(std::string const&, unsigned short) ()

I did not get further in the debugging, since the crasched widelands still takes up my screen, and I don't know how to reach the terminal where gdb is running. I eventually killed gdb from a textmode terminal (CTRL+ALT+F1).

More observations:
-tooltips work in windowed mode
-which resolution I choose in fullscreen mode does not seem to matter
-I have seen the crasch with several of the tooltips on the options screen, and also while trying to start a new game (victory conditions, I think).

Revision history for this message
Fredrik Jansson (fjansson) wrote :
Revision history for this message
Fredrik Jansson (fjansson) wrote :

Now I got a backtrace as well. It turned out I did a release build initially, but now I made a new build in debug mode.
To keep acces to gdb, with Widelands in fullscreen, I did the following:

CTRL+ALT+F1 to a console, log in
cd to the widelands directory
export DISPLAY=:0.0
gdb widelands
run
CTRL+ALT+F8 to X-windows
find the widelands window, cause it to crash as above
CTRL+ALT+F1 to the console
bt

The backtrace:
Program received signal SIGSEGV, Segmentation fault.
0x0000000000ac4e1c in UI::Font_Handler1::render (this=0x15f1030, text=..., w=360) at /home/fjansson/wl/widelands/src/graphic/font_handler1.cc:99
99 if (image_cache_->has(hash))
(gdb) bt
#0 0x0000000000ac4e1c in UI::Font_Handler1::render (this=0x15f1030, text=..., w=360) at /home/fjansson/wl/widelands/src/graphic/font_handler1.cc:99
#1 0x0000000000a3ce3c in UI::Panel::draw_tooltip (dst=..., text=...) at /home/fjansson/wl/widelands/src/ui_basic/panel.cc:1122
#2 0x0000000000a3afa5 in UI::Panel::run (this=0x2058bd0) at /home/fjansson/wl/widelands/src/ui_basic/panel.cc:192
#3 0x0000000000a8972b in Options_Ctrl::handle_menu (this=0x7fffffffd580) at /home/fjansson/wl/widelands/src/ui_fsmenu/options.cc:650
#4 0x0000000000a8969d in Options_Ctrl::Options_Ctrl (this=0x7fffffffd580, s=...) at /home/fjansson/wl/widelands/src/ui_fsmenu/options.cc:641
#5 0x00000000009a15bb in WLApplication::mainmenu (this=0x12a0190) at /home/fjansson/wl/widelands/src/wlapplication.cc:1583
#6 0x000000000099c7ba in WLApplication::run (this=0x12a0190) at /home/fjansson/wl/widelands/src/wlapplication.cc:475
#7 0x000000000099a9fe in main (argc=1, argv=0x7fffffffe6f8) at /home/fjansson/wl/widelands/src/main.cc:107

Doug Lomax (dlomax11)
summary: - displaying tooltips in fullscreen causes crasch
+ displaying tooltips in fullscreen causes crash
Revision history for this message
SirVer (sirver) wrote :

Okay, the fundamental problem here is that changing the graphic settings deletes the g_gr object. This deletes the surface cache and the image cache. Now, all the UI elements in the main menu hold on to a Pointer to the IPictures that where in the image cache - but they no longer exist.

The correct solution (imho) is to also delete and recreate the whole UI so that the images are reloaded. Or maybe it is possible to add a reinitialize method to class Graphic that will purge the SurfaceCache (but not delete it!) - this seems to be easier to do but less clean.

Changed in widelands:
status: New → Confirmed
importance: Undecided → High
assignee: nobody → SirVer (sirver)
milestone: none → build18-rc1
Revision history for this message
Hans Joachim Desserud (hjd) wrote :

Can also be triggered after changing resolution, see bug 1159968.

tags: added: crash ui
Revision history for this message
SirVer (sirver) wrote :

I started working on this and I have something that sortof works - but it crashes in random places on my machine. I would appreciate some testing and maybe a reliable way to reproduce a crash. The code is in lp:~widelands-dev/widelands/graphic_resetting.

Revision history for this message
Hans Joachim Desserud (hjd) wrote :

I am no longer able to reproduce this crash in r6637 (after branch SirVer mentions above was merged), and therefore believe this to be fixed. If you are still able to trigger the crash, please let us know.

Changed in widelands:
status: Confirmed → Fix Committed
tags: added: regression
Revision history for this message
Fredrik Jansson (fjansson) wrote :

I (the OP) can no longer reproduce the bug with r6637.

Revision history for this message
SirVer (sirver) wrote :

Thanks for verifying.

SirVer (sirver)
Changed in widelands:
assignee: SirVer (sirver) → nobody
Revision history for this message
SirVer (sirver) wrote :

Released in build-18 rc1.

Changed in widelands:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.