Calling LibFree() on a 'Mesh' library crashes the game if a 'Scene' library was loaded before it
Open, NormalPublic


System Information
Windows 7 64-bit
Intel HD Graphics 4000

Blender Version
Broken: 2.78 (3c04373)


-- Contains an Empty that runs the following script:

import bge

basePath = bge.logic.expandPath('//')

# if a 'Scene' library is loaded before a 'Mesh' library,
# the engine will crash when you attempt to free the 'Mesh' library
pathList = [
    ('scenelib.blend', 'Scene'),
    ('meshlib.blend', 'Mesh'),

# load libraries
for path, mode in pathList:
    print('loading:', path)
    bge.logic.LibLoad(basePath + path, mode, async=False)

# free libraries
for lib in bge.logic.LibList():
    print('Freeing %s' % lib)

-- Just contains the default cube
-- Just contains Suzanne

Short description of error
The BGE crashes when calling LibFree() on a library that was loaded in "Mesh" mode if there was a library loaded before it that was loaded in "Scene" mode.

Exact steps for others to reproduce the error
Place the attached files in the same folder. Open load.blend and run the start the game engine. It should crash immediately (Occasionally it won't crash on the first run. If so, it should crash upon starting the game engine a few more times).

The crash appears to only occur when a library was loaded in 'Scene' mode before the 'Mesh' library was loaded (e.g. changing the order of the libraries in pathList or changing 'Scene' to 'Mesh' will avoid the crash).

Additional Notes

  • As far as I can tell, the contents of the loaded files (scenelib.blend and meshlib.blend) do not matter
  • The order the libraries are freed in does not seem to matter (e.g. freeing 'Mesh' library before the 'Scene' library does not avoid the crash)
  • The crash still occurs if you free the 'Scene' library before loading the 'Mesh' library


mobious created this task.Feb 24 2017, 1:44 AM
Sergey Sharybin (sergey) triaged this task as Normal priority.Jun 9 2017, 11:41 AM