Proper way to use LibFree()?

For my game I am building a system that allows me to load assets with LibLoad().
For now Blender crashes if I toggle LibLoad() and LibFree() for a few times.
(I have no idea where in Windows the Crash reports go).

EDIT: This is what blender error log generated in Windows (I’ll check on Linux later at home):
“# Blender 2.69 (sub 0), Revision: 60995”
Not much of a help I guess.

Anyway below is the script I am using and I would like to know what I’m doing wrong :slight_smile:
script is commented


import bge

def model(cont):
    scene = bge.logic.getCurrentScene()

    #When a message 'player model' is recieved,
    #a loop will check the message bodies
    for body in cont.sensors['Message'].bodies:
        print (body)

        #If message body is 'free'
        if body == 'None':

            #Loop through library list
            for lib in bge.logic.LibList():

                #If list item contains 'player'
                if lib.find('player') != -1:

                    #Free the camera from its parent
                    cont.owner.removeParent()

                    #Free the library asset
                    bge.logic.LibFree(lib)

                    #Set the globaldictionary variable to None
                    bge.logic.globalDict['Player info']['Model'] = None

        #If message body is 'gm'
        elif body == 'gm':

            #Load a model defined in message
            bge.logic.LibLoad('//assets/models/player/'+body+'.blend', 'Scene', load_actions = True, async = False)

            #Set the globaldictionary variable to 'gm'
            bge.logic.globalDict['Player info']['Model'] = body

EDIT: Argh Sorry I posted on wrong section, cold someone move this post?

The code looks fine to me. Try to start blender with the -d option (from a console) to see if it spits out some information about the crash, when it happens.

Moved from “Works in Progress and Game Demos” to “Game Engine Support and Discussion”

Hmm I tried it at home on Linux machine and it wont crash. It only crashed on Windows at work.
Does Blender generate any error logs in Windows and if so, where are they?