Set Origin tool crashed the editor

Bug #1566720 reported by GunChleoc
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
widelands
Fix Released
Undecided
Unassigned

Bug Description

To reproduce:

1. Start the editor
2. Set the origin
3. Click "Undo"

Tags: crash editor

Related branches

Revision history for this message
kaputtnik (franku) wrote :

I could confirm this with r7942. I believe the crash happens when set Origin points on a coordinate with x=0, f.e. 0, 5. Such coordinates triggers the crash reproducible.

widelands: /home/kaputtnik/Quellcode/widelands-repo/trunk/src/logic/map.cc:340: void Widelands::Map::set_origin(Widelands::Coords): Assertion `new_origin.x < width_' failed

Changed in widelands:
status: New → Confirmed
Revision history for this message
kaputtnik (franku) wrote :

This is caused by map->get_width() which returns 64 for a map with width 64. The width is counted here as range 1 to 64, but map->set_origin counts range 0 to 63.

My solution would be to subtract 1 to both (width and height) in

http://bazaar.launchpad.net/~widelands-dev/widelands/trunk/view/head:/src/editor/tools/set_origin_tool.cc#L48

I am compiling my changes now and if i am ready i propose a branch. Somebody should may check the other usages of map->get_width() and map->get_height() to prevent some more bugs under this circumstances.

Revision history for this message
GunChleoc (gunchleoc) wrote :

Yes, please propose a branch. We can then use it as a base to double-check the other uses.

GunChleoc (gunchleoc)
Changed in widelands:
status: Confirmed → Fix Committed
GunChleoc (gunchleoc)
Changed in widelands:
status: Fix Committed → Fix Released
Revision history for this message
GunChleoc (gunchleoc) wrote :

Fixed in build19-rc1.

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.