Jump to content

self.world:Clear() bug


Recommended Posts

I'm using leadwerks steam edition.

Had windows critical on attempt to clear world before, now

it fail on the self.world:Clear() line with following output:

 

 

I've opted into beta and have created project just for testing.

I've got following error now, instead of windows critical:

Object reference count error.

And output like

 

 

Quote

 

Map file = maps/second.map

Deleting material "e:/leadwerks projects/projectfortests/materials/developer/greengrid.mat"

Deleting shader "E:/Leadwerks projects/Changetest/shaders/model/diffuse.shader"

Deleting texture "e:/leadwerks projects/projectfortests/materials/developer/greengrid.tex"

Deleting texture "E:/Leadwerks projects/Changetest/Materials/Common/bfn.tex"

Deleting shader "E:/Leadwerks projects/Changetest/Shaders/Lighting/ambientlight.shader"

Setting breakpad minidump AppID = 251810

Steam_SetMinidumpSteamID: Caching Steam ID: 76561197981090266 [API loaded no]

Process Complete.

 

 

 

and here is the project i've created just to test that

http://yadi.sk/d/7oKiE7UEK2cgM

 

aaand the thread there it all started.

http://www.leadwerks.com/werkspace/topic/8840-levelchange-problems/

Link to comment
Share on other sites

Here's some of my systems specs, if it helps. Just got the time to post these. wacko.png

 

 

 

OPERATING SYSTEM: Windows 2.6.2.9200

CPU TYPE: AMD FX™-8120 Eight-Core Processor

CPU SPEED: 3.13 GHz

SYSTEM MEMORY: 8.49 GB

VIDEO CARD MODEL: NVIDIA GeForce GTX 570

VIDEO CARD MEMORY: 4.24 GB

VIDEO CARD DRIVER: nvd3dum.dll

DESKTOP RESOLUTION: 1920x1080

HARD DISK SIZE: 566.23 GB

HARD DISK FREE SPACE: 294.96 GB (52%)

 

Link to comment
Share on other sites

Are you sure this is a bug now? From the log it looks like it's starting to clear the world (all the deletes). Did you try this with a very bare min level?

Yep, and that Level is in the project i've attached to the post.

Well, you've seen lua code, and said it's nothing wrong with it, so i assume it is a bug, since there is no other way to unload the world.

Besides, windows critical is definatly a bug, if you ask me.

Here's the screenshot btw.

yddPjPOYoOE.jpg

Link to comment
Share on other sites

So as is this did crash for me. It looks like it actually has something to do with the player entity. I removed the player, then made a basic script and attached it to the floor. This script changes the level using the same App:SwitchLevel() if the 'L' key is pressed in the UpdateWorld() function and it worked fine. Something to do with when the engine does to free the player.

 

I don't have enough time right now to dig into the player script, but it's for sure something in there that's causing issues. Maybe create a Script:Delete() function (this is what the engine should call when it's freeing up the entity) and free some resources that were loaded in Script:Start()?

Link to comment
Share on other sites

Yep, issue seems to be with unloading the standart FPSplayer.lua script.

I've used TPS/FPS player script from here http://www.leadwerks.com/werkspace/files/file/436-fps-and-tps-controller/

And it works fine now. I can't say what is the key difference between these two scripts, but then again, i don't know how world:clear works, since i have indie edition.So i just don't know where to look.

I'll try to poke around in the player script and see if i can make it unload properly.

Thanks for the advise by the way smile.png

Link to comment
Share on other sites

hello,

 

both scripts are completely different and have not much in common i would say.

 

One thing you could try is to check the Release method

function Script:Release()
self.listener:Release()
self.flashlight:Release()
if self.corpse~=nil then
 self.corpse:Release()
 self.corpse=nil
end
ReleaseTableObjects(self.sound)
ReleaseTableObjects(self.image)
end

 

since the error happens on unload of the map and the other script has no Release method

Link to comment
Share on other sites

So in FPSPlayer.lua in Script:Release() (which I thought it should be Delete() now, but I see both Release() and Delete() work) if you comment out the releasing of the listener and flashlight the program doesn't crash anymore. So something with releasing those 2 entities causes the crash.

Link to comment
Share on other sites

This is a tricky situation. The player script is releasing the listener entity, but the listener entity has already previously been deleted by the World:Clear() function, so it is no longer a valid object.

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

Okay, I added an extra loop so first the scripts will be detached and then the entities released. This will work in the next update on Steam.

 

The correct function name according to the docs is Script:Delete(), but internally Release() and Detach() are also called, just to retain backwards compatibility:

http://www.leadwerks.com/werkspace/page/documentation/_/script-reference/

 

Thank you.

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

×
×
  • Create New...