Issue information

Issue ID
#6818
Status
Confirmed
Severity
Medium
Started
Hercules Elf Bot
Oct 25, 2012 2:11
Last Post
Hercules Elf Bot
Nov 10, 2012 22:27
Confirmation
Yes (2)
No (0)

Hercules Elf Bot - Oct 25, 2012 2:11

Originally posted by [b]mkbu95[/b]
Well I was trying to fix the following behavior:

- Open a npc shop;
- Put an item in the "Buying Items" or not (optional);
- Use @reloadscript;
- Click to "Buy" the item;
- It'll show "Out of the maximum capacity" if you didn't got any early message. For example, let's say you tried to buy an item which you can't afford. You'll get that message "you don't have enough zeny blablabla" and then if you try to reproduce this "bug" (not sure even if i can call this a bug anymore) you'll get again that message, don't know exactly why.

The first time you'll get this error (one of the two, the first seems to be less likely):
[code][Error]: Memory manager: freed-data is changed. (freed in c:\users\admin\desktop\rathena\src\map\map.c line 2104)[/code]
[code][Error]: Memory manager: freed-data is changed. (freed in c:\users\admin\desktop\rathena\src\map\script.c line 2997)[/code]
Do it again, and you will get this message instead:
[code][Error]: Memory manager: args of aFree 0x07EBABFD is invalid pointer c:\users\admin\desktop\rathena\src\map\script.c line 2996[/code]

I was trying to make sure that after using @reloadscript that data wouldn't be freed.
The thing is, I'm not used to play with that stuff and I had to make a lot of testing, and now I can't get rid of this error.

Using @reloadscript alone shows those errors.
After doing this a lot of times, in a fresh login and using @reloadscript for the first time I got nothing, and then using it again I got the second error (... invalid pointer ...)

Now, another thing happened (I'm writing this part 2 hours after the @reloadscript one).
I've disabled all maps (except Prontera), all npcs (except for one 'npc:/a.txt' -- custom) because it loads the emulator faster.
Anyway, this is the content of the 'a.txt':
[code]//prontera,150,150,5 shop PetShop1 83,9001:1000,9002:1000,9003:1000,9004:2000,501:60
//prontera,152,150,5 cashshop PetShop2 84,9001:1000,9002:1000,9003:1000,9004:1000
//prontera,154,150,5 shop PetShop3 83,501:-1,502:-1,503:-1,607:-1,999:-1
prontera,156,150,5 script PetShop4 46,{
mes "oi";
close;
}[/code]
And this is what I get from clicking in the 'PetShop4' (I was testing [url="http://rathena.org/board/tracker/issue-6816-pet-egg/"]this[/url] bug :V):
[code][Error]: unknown command : 6 @ 1[/code]

After that I changed the script to this:
[code]//prontera,150,150,5 shop PetShop1 83,9001:1000,9002:1000,9003:1000,9004:2000,501:60
//prontera,152,150,5 cashshop PetShop2 84,9001:1000,9002:1000,9003:1000,9004:1000
//prontera,154,150,5 shop PetShop3 83,501:-1,502:-1,503:-1,607:-1,999:-1
prontera,156,150,5 script PetShop4 46,{
mes "oi";
next;
mes "oia";
close;
}[/code]
And used @reloadscript. I got that second error message (invalid pointer) and the npc worked.
A few seconds later (1 or 3 seconds) after closing the npc dialog, the first message (regarding to freed-data) popped up.
I used the npc a lot of times but the message didn't show again, so I think it was a delay from the @reloadscript.

Another @reloadscript, that time to enable all npcs, making the file look like this:
[code]prontera,150,150,5 shop PetShop1 83,9001:1000,9002:1000,9003:1000,9004:2000,501:60
prontera,152,150,5 cashshop PetShop2 84,9001:1000,9002:1000,9003:1000,9004:1000
prontera,154,150,5 shop PetShop3 83,501:-1,502:-1,503:-1,607:-1,999:-1
prontera,156,150,5 script PetShop4 46,{
mes "oi";
next;
mes "oia";
close;
}[/code]
And I got this message:
[code][Error]: Memory manager: freed-data is changed. (freed in c:\users\matheus\admin\rathena\src\map\map.c line 2104)[/code]
Notice that the line is different from the usual.

I tried to use 'PetShop4' again and got the same error:[code][Error]: unknown command : 6 @ 1[/code]

I'm posting here because my emulator is clean, I recompiled a thousand times (both Debug and Release), deleted the files (script.c/.h), even restarted my computer.

One way or another this is something that should be prevented (the behavior).

This post has been edited by mkbu95 on Nov 2, 2012 1:48

Hercules Elf Bot - Nov 10, 2012 5:01

Originally posted by [b]mkbu95[/b]
Fixed in [rev=16897]

Hercules Elf Bot - Nov 10, 2012 22:27

Originally posted by [b]mkbu95[/b]
New tests indicate that the issue had nothing to do with pet eggs and whatsoever.