Home

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.
ianwill (Willian Padovani Germano) closed this task as "Archived".Via Old WorldApr 11 2004, 6:05 AM
None (Nobody) added a comment.Via Old WorldFeb 24 2004, 6:25 AM

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