Merge branch 'alphabet-leak' (Fixes #3049)

This commit is contained in:
Reuben Morais 2020-06-08 13:59:01 +02:00
commit ba7b0f7436

View File

@ -43,7 +43,13 @@ namespace std {
%template(OutputVectorVector) std::vector<std::vector<Output>>;
// Import only the error code enum definitions from deepspeech.h
%ignore "";
%rename("%s", regexmatch$name="DS_ERR_") "";
%rename("%s", regexmatch$name="DeepSpeech_Error_Codes") "";
// We can't just do |%ignore "";| here because it affects this file globally (even
// files %include'd above). That causes SWIG to lose destructor information and
// leads to leaks of the wrapper objects.
// Instead we ignore functions and classes (structs), which are the only other
// things in deepspeech.h. If we add some new construct to deepspeech.h we need
// to update the ignore rules here to avoid exposing unwanted APIs in the decoder
// package.
%rename("$ignore", %$isfunction) "";
%rename("$ignore", %$isclass) "";
%include "../deepspeech.h"