Gamestudio Links
Zorro Links
Newest Posts
ZorroGPT
by TipmyPip. 02/21/26 19:15
Camera always moves upwards?
by clonman. 02/21/26 09:29
Zorro version 3.0 prerelease!
by TipmyPip. 02/20/26 13:22
Sam Foster Sound | Experienced Game Composer for Hire
by titanicpiano14. 02/19/26 13:22
AUM Magazine
Latest Screens
Dorifto samurai
Shadow 2
Rocker`s Revenge
Stug 3 Stormartillery
Who's Online Now
0 registered members (), 6,962 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
alx, ApprenticeInMuc, PatrickH90, USER0328, Sfrdragon
19199 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 2 of 3 1 2 3
Re: possible Bug in file_save (A7.82.3) [Re: pegamode] #305352
01/14/10 10:46
01/14/10 10:46
Joined: Jul 2000
Posts: 28,074
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 28,074
Frankfurt
Just send brief email to support, or post it here, so that we know when file is uploaded.

Re: possible Bug in file_save (A7.82.3) [Re: jcl] #305435
01/14/10 19:42
01/14/10 19:42
Joined: Feb 2006
Posts: 1,011
Germany
pegamode Offline OP
Serious User
pegamode  Offline OP
Serious User

Joined: Feb 2006
Posts: 1,011
Germany
I think I got a step further.

I added some lines to my code:

Code:
var result = file_save(savename, savegame, sizeof(SAVEGAME));					
	diag("\nafter save.");
	if (result == NULL) {
		error("filesave error");
	}
	diag("\nafter save 2.");
	ediag(fctName, LEVEL_INFO, _str("saved savegame."));



Then I wait until the crash occured and the logfile looks like this:

[20:38:16] INFO [function save_game(STRING* savename)]: saving savegame.
after save.
Error E1513: Crash in save_game

So the error occurs in one of the following lines:

Code:
if (result == NULL) {
		error("filesave error");
	}



Any ideas?

Regards,
Pegamode.

Re: possible Bug in file_save (A7.82.3) [Re: pegamode] #305437
01/14/10 19:45
01/14/10 19:45
Joined: Feb 2006
Posts: 1,011
Germany
pegamode Offline OP
Serious User
pegamode  Offline OP
Serious User

Joined: Feb 2006
Posts: 1,011
Germany
Ahhh ...

just a moment ... result is an internal variable, isn't it ?!?

I'll change it and see if this helps.

Re: possible Bug in file_save (A7.82.3) [Re: pegamode] #305444
01/14/10 20:08
01/14/10 20:08
Joined: Feb 2006
Posts: 1,011
Germany
pegamode Offline OP
Serious User
pegamode  Offline OP
Serious User

Joined: Feb 2006
Posts: 1,011
Germany
I think that solved the problem ... I changed the variable name and until now (knocking on wood :-) ) I couldn't reproduce the problem.

Re: possible Bug in file_save (A7.82.3) [Re: pegamode] #305509
01/15/10 09:41
01/15/10 09:41
Joined: Jul 2000
Posts: 28,074
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 28,074
Frankfurt
This is not really an explanation - the name "result" of a variable can not cause a crash. There's a different reason.

Somewhere in your code, a memory area is possibly overwritten, causing a crash when this area is accessed - for instance, the string "filesave error". This is why the crash does not happen always, but only sometimes.

Re: possible Bug in file_save (A7.82.3) [Re: jcl] #305516
01/15/10 10:10
01/15/10 10:10
Joined: Feb 2006
Posts: 1,011
Germany
pegamode Offline OP
Serious User
pegamode  Offline OP
Serious User

Joined: Feb 2006
Posts: 1,011
Germany
Hmm ... that's not good news.

But everytime the crash occurs the file is written correctly. That means that the result shouldn't be NULL, doesn't it?

If a memory area is overwritten a diag could also crash, couldn't it?

This could be getting hard to find where the problem really comes from.

Yesterday I couldn't reproduce the problem after I've renamed the variable.
I'll try it this evening again.

Do you have any hints how to check if a memory area is overwritten?

Regards,
Pegamode.

Re: possible Bug in file_save (A7.82.3) [Re: pegamode] #305518
01/15/10 10:56
01/15/10 10:56
Joined: Jul 2000
Posts: 28,074
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 28,074
Frankfurt
Yes, when you allocated it with sys_malloc. This contains a check against such bugs. No when it's an overwritten array, a file with wrong internal pointers, or something that you constructed with malloc().

Re: possible Bug in file_save (A7.82.3) [Re: jcl] #305522
01/15/10 11:15
01/15/10 11:15
Joined: Feb 2006
Posts: 1,011
Germany
pegamode Offline OP
Serious User
pegamode  Offline OP
Serious User

Joined: Feb 2006
Posts: 1,011
Germany
Ok. So I have to do some checks ...

Strange that we could reproduce the problem since the var was renamed yet. Usually 1 out of 10 saves crashed.

Would you recommend to replace all malloc() with sys_malloc()?


Last edited by pegamode; 01/15/10 11:28.
Re: possible Bug in file_save (A7.82.3) [Re: pegamode] #305524
01/15/10 11:33
01/15/10 11:33
Joined: Jul 2000
Posts: 28,074
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 28,074
Frankfurt
Yes. sys_malloc is an engine function with many safeguards, while malloc is just the common C/C++ function, with safeguarding in the programmer's responsibility.

Re: possible Bug in file_save (A7.82.3) [Re: jcl] #305526
01/15/10 11:37
01/15/10 11:37
Joined: Feb 2006
Posts: 1,011
Germany
pegamode Offline OP
Serious User
pegamode  Offline OP
Serious User

Joined: Feb 2006
Posts: 1,011
Germany
Ok ... then I'll replace them all.

Does sys_malloc log out something when the size enlarged?
It would be great to see if there are any overflows.

Page 2 of 3 1 2 3

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1