mirror of https://github.com/swig/swig
Fix segfault in C# layer handling using declarations
Segfault was actually avoided in previous commit ab23cb29. This commit makes handling more robust in the event of using %ignore just on the derived method, not tested as it is not what one should do with directors, and possibly other cases. Go still segfaults with the new testcase director_using_member_scopes.i. Issue #1441.
This commit is contained in:
parent
bd5ffe86e4
commit
c88a9436bc
|
@ -218,6 +218,7 @@ CPP_TEST_CASES += \
|
||||||
director_thread \
|
director_thread \
|
||||||
director_unroll \
|
director_unroll \
|
||||||
director_using \
|
director_using \
|
||||||
|
director_using_member_scopes \
|
||||||
director_void \
|
director_void \
|
||||||
director_wombat \
|
director_wombat \
|
||||||
disown \
|
disown \
|
||||||
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
%module(directors="1") director_using_member_scopes
|
||||||
|
|
||||||
|
// Similar to using_member_scopes but for directors
|
||||||
|
|
||||||
|
#if !defined(SWIGGO)
|
||||||
|
|
||||||
|
%feature("director");
|
||||||
|
// Python,Java,C# no diffs in generated code when adding in nodirector. Go not happy even without %nodirector.
|
||||||
|
// Fully qualifying parameter types in a method declared after the using declaration caused
|
||||||
|
// a method being incorrectly added by the using declaration even though the declaration already existed
|
||||||
|
|
||||||
|
// Github issue #1441 - segfault in Go and C#
|
||||||
|
|
||||||
|
%inline %{
|
||||||
|
namespace OgreBites
|
||||||
|
{
|
||||||
|
struct NativeWindowType {};
|
||||||
|
class ApplicationContextBase {
|
||||||
|
public:
|
||||||
|
virtual ~ApplicationContextBase() {}
|
||||||
|
virtual void setWindowGrab(NativeWindowType* win, bool grab = true) {}
|
||||||
|
void setWindowGrab(bool grab = true) {}
|
||||||
|
};
|
||||||
|
class ApplicationContextSDL : public ApplicationContextBase {
|
||||||
|
public:
|
||||||
|
using ApplicationContextBase::setWindowGrab;
|
||||||
|
void setWindowGrab(NativeWindowType* win, bool grab) {} // This should not be added again as it exists in base class
|
||||||
|
};
|
||||||
|
}
|
||||||
|
%}
|
||||||
|
|
||||||
|
#endif
|
|
@ -2553,8 +2553,8 @@ public:
|
||||||
Replaceall(imcall, "$imfuncname", intermediary_function_name);
|
Replaceall(imcall, "$imfuncname", intermediary_function_name);
|
||||||
String *excode = NewString("");
|
String *excode = NewString("");
|
||||||
Node *directorNode = Getattr(n, "directorNode");
|
Node *directorNode = Getattr(n, "directorNode");
|
||||||
if (directorNode) {
|
UpcallData *udata = directorNode ? Getattr(directorNode, "upcalldata") : 0;
|
||||||
UpcallData *udata = Getattr(directorNode, "upcalldata");
|
if (udata) {
|
||||||
String *methid = Getattr(udata, "class_methodidx");
|
String *methid = Getattr(udata, "class_methodidx");
|
||||||
|
|
||||||
if (!Cmp(return_type, "void"))
|
if (!Cmp(return_type, "void"))
|
||||||
|
|
Loading…
Reference in New Issue