|
|
#1 |
|
Swordsman
Join Date: Apr 2008
Posts: 451
![]() |
[3.4-dev] Obscure bug with queues
I didn't check all the calls to "struct queue" in the code, but the ones in generate.c and obj-util.c assume that the queue can handle "size" pointers when created with a size of "size".
When looking at the code in z-queue.c, pushing "size" items in a queue of size "size" will not work: Code:
void q_push(struct queue *q, uintptr_t item) {
q->data[q->tail] = item;
q->tail = (q->tail + 1) % q->size;
if (q->tail == q->head) abort();
}
Fix: either allow one more item in the queue, or add +1 to queue size when calling q_new().
__________________
PWMAngband variant maintainer - check http://www.mangband.org/forum/viewforum.php?f=9 to learn more about this new variant! |
|
|
|
|
|
#2 | |
|
Angband Devteam member
Join Date: Aug 2008
Location: Philadelphia, PA, USA
Age: 32
Posts: 1,494
![]() |
Quote:
Yeah, it probably should call something else instead. I will fix this and also try to do something a bit more friendly. |
|
|
|
|
|
|
#3 |
|
Angband Devteam member
Join Date: Aug 2008
Location: Philadelphia, PA, USA
Age: 32
Posts: 1,494
![]() |
OK, this is fixed in angband/master and v4/v4-master.
I chose to use (size + 1) in q_new so that if the user wants a queue of size 40 it allocates 41 buckets. Thanks again for catching this! |
|
|
|
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Untraceable bug in dev versions - help! | Magnate | Development | 5 | September 20, 2011 21:04 |
| A question to the dev team regarding new ID-by-use (possible bug) | PowerWyrm | Vanilla | 3 | August 27, 2010 17:30 |
| Dev Bug | rdermyer | Vanilla | 13 | December 24, 2008 02:49 |
| Fear Bug In Dev Version | LordArcher | Vanilla | 2 | November 30, 2008 20:04 |
| [Dev] major Fear bug. | Irashtar | Vanilla | 1 | August 31, 2008 03:03 |