KTyJLXy Posted March 5, 2014 Share Posted March 5, 2014 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 More sharing options...
KTyJLXy Posted March 6, 2014 Author Share Posted March 6, 2014 Here's some of my systems specs, if it helps. Just got the time to post these. 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 More sharing options...
Rick Posted March 6, 2014 Share Posted March 6, 2014 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? Link to comment Share on other sites More sharing options...
KTyJLXy Posted March 7, 2014 Author Share Posted March 7, 2014 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. Link to comment Share on other sites More sharing options...
Rick Posted March 7, 2014 Share Posted March 7, 2014 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 More sharing options...
KTyJLXy Posted March 7, 2014 Author Share Posted March 7, 2014 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 Link to comment Share on other sites More sharing options...
beo6 Posted March 7, 2014 Share Posted March 7, 2014 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 More sharing options...
Rick Posted March 7, 2014 Share Posted March 7, 2014 Note that Release() is the wrong script function name. This was update in one of the patches. It's Delete(). Change the name in the FPS script from Release() to Delete() and see if that helps. http://www.leadwerks.com/werkspace/page/documentation/_/script-reference/ Link to comment Share on other sites More sharing options...
Josh Posted March 8, 2014 Share Posted March 8, 2014 I will be able to look at this soon. Been knee-deep in penguin dung this week. 1 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 More sharing options...
Rick Posted March 9, 2014 Share Posted March 9, 2014 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 More sharing options...
Rick Posted March 9, 2014 Share Posted March 9, 2014 It's looking like anytime we call Release() on something inside a scripts Delete() function it crashes the game. Link to comment Share on other sites More sharing options...
Josh Posted March 17, 2014 Share Posted March 17, 2014 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 More sharing options...
Josh Posted March 17, 2014 Share Posted March 17, 2014 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 More sharing options...
Recommended Posts