FileSelector SEGV on dynamic callback
Closed, ArchivedPublic

Description

Group: V 2.31 release
Resolution: Fixed
Category: Python

Running the following script provokes causes Blender to
fail with a SIGSEGV:

import Blender.Window

def make_callback(func):
def callback(filename):
print "start callback"
func(filename)
print "end callback"
return callback

def poing(filename):
print "filename =", filename

Blender.Window.FileSelector(make_callback(poing),'Poing')

The problem is caused by
blender/python/api2_2x/Window.c:M_Window_FileSelector()
which fails to Py_INCREF(EXPP_FS_PyCallback) before
returning. If this is added, then the corresponding
Py_DECREF must be done prior to setting
EXPP_FS_PyCallback = NULL, ie in getSelectedFile(), and
also at the top of M_Window_FileSelector(), prior to
calling PyArg_ParseTuple(), to handle the case where
the user canceled the file select hence
getSelectedFile() never got called hence
EXPP_FS_PyCallback is still not NULL.

Details

Type
Bug

This task was automatically closed as archived as part of migration, because the project or tracker this task belonged to is no longer active.

Add Comment