mettli / guichan

Automatically exported from code.google.com/p/guichan
Other
0 stars 0 forks source link

gcn::Icon resizes on setImage regardless of parameters. #132

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Calling gcn::Icon::setImage() automatically resizes the widget to the size 
of the new image.  This is normally ok, but if a null image is passed 
(indicating that the user doesn't want an image displayed) then this 
method segfaults.

Checking whether an image was passed could easily fix the problem.  See 
attached.

PS: Sorry for the sudden slew of reports :-p

Original issue reported on code.google.com by holy.smo...@gmail.com on 13 Feb 2010 at 5:39

Attachments:

GoogleCodeExporter commented 9 years ago
Passing a null pointer to the Icon is begging for problems. I think the user 
deserves a 
crash.

Original comment by olof.nae...@gmail.com on 14 Feb 2010 at 5:12

GoogleCodeExporter commented 9 years ago
Agreed, but at the same time the library allows a default constructor which 
accepts
no gcn::Image (where one could be set later) and will not receive a segfault 
because
the draw method checks for its existence.  Should that constructor be removed 
then?

Original comment by holy.smo...@gmail.com on 15 Feb 2010 at 4:30

GoogleCodeExporter commented 9 years ago
That does sound a bit inconsistent. Btw, please use a unified diff for your 
patches, 
then they provide a bit of context. :-)

Original comment by b.lindeijer on 15 Feb 2010 at 5:30