public inbox for xconq7@sourceware.org
 help / color / mirror / Atom feed
From: Hans Ronne <hronne@comhem.se>
To: Lincoln Peters <sampln@sbcglobal.net>
Cc: xconq7@sources.redhat.com
Subject: Re: Segfault in side_material_production
Date: Wed, 12 Nov 2003 00:35:00 -0000	[thread overview]
Message-ID: <l03130301bbd7253ded1f@[212.181.162.155]> (raw)
In-Reply-To: <1068593599.29637.222.camel@odysseus.peterslan>

>While testing a new game module, I encountered a bug that I am sure was
>introduced within the last few months (I'm not exactly how long ago it
>could have come up, as I have not had time to work on it for a while).
>Looking at the backtrace (see below), I suspect it has something to do
>with the recent changes to the material display code, although I cannot
>reproduce the bug in any of the games currently in the Xconq library.
>
>The GDB message is:
>
>Program received signal SIGSEGV, Segmentation fault.
>0x08108369 in side_material_production (side=0x8459e18, m=0) at side.c:3742
>3742                                    if (user_at(x, y) == unit->id) {

Thanks! The changes to the material code were massive and did not only
involve the display, so I have been waiting for bugs to pop up. In fact, I
just found one myself: the Civ2 game would hang after one or two turns due
to an infinite while loop. I will check in a fix for that soon.

Looking at the code, I can see immediately what is wrong. This piece of
advanced-unit code was taken verbatim from run_advanced_units to make
Peter's material display work correctly with advanced untis. However,
run_advanced_units also checks first that the user area layer exists and
mallocs one if it does not. Unfortunately, this check did not make it to
the new location. It illustrates the perils of cutting and pasting code
from one place to another!

I will check in a fix for this as well later. If you want to test the fix
right away, just put these lines at the start of side_material_production:

if (!user_defined()) {
    allocate_area_users();
}

and things should work fine.

Hans

P.S. I haven't forgotten about the game modules you sent me earlier. There
were a number of bugs I had to fix, though, before I could finish the game
modules overhaul. Is this one of these modules, and do you want to update
it?


  reply	other threads:[~2003-11-12  0:25 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-11-12  0:25 Lincoln Peters
2003-11-12  0:35 ` Hans Ronne [this message]
2003-11-12  5:57   ` Lincoln Peters

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='l03130301bbd7253ded1f@[212.181.162.155]' \
    --to=hronne@comhem.se \
    --cc=sampln@sbcglobal.net \
    --cc=xconq7@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).