From: SourceForge.net <no...@so...> - 2007-10-25 10:24:30
|
Bugs item #1746818, was opened at 2007-07-02 22:00 Message generated for change (Comment added) made by soccia79 You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=101645&aid=1746818&group_id=1645 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: csharp Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: Berserker (berserker_r) Assigned to: William Fulton (wsfulton) Summary: Directors bug with virtual protected methods Initial Comment: // C++ code %feature("director") Alfa; class Alfa { public: Alfa() { } virtual ~Alfa() { } protected: virtual void test() { } }; %feature("director") Beta; class Beta : public Alfa { public: Beta() { } virtual ~Beta() { } }; // C# code public class Gamma : Beta { public Gamma() { } public void foo() { test(); } } public static class Program { static void Run() { Gamma g = new Gamma(); g.foo(); } } The "foo" call causes an access violation in the C++ code generated by swig, in particular the problem is here: SWIGEXPORT void SWIGSTDCALL CSharp_Alfa_testSwigExplicitAlfa(void *jarg1) { Alfa *arg1 = (Alfa *) 0 ; SwigDirector_Alfa *darg = 0; arg1 = (Alfa *)jarg1; darg = dynamic_cast<SwigDirector_Alfa *>(arg1); (darg)->testSwigPublic(); } arg1 is a SwigDirector_Beta instance (not SwigDirector_Alfa) so the dynamic_cast here returns null and the "testSwigPublic" call causes an access violation. ---------------------------------------------------------------------- Comment By: soccia79 (soccia79) Date: 2007-10-25 10:24 Message: Logged In: YES user_id=1836240 Originator: NO > 4 months and no patches yet...any hope? Quoted ---------------------------------------------------------------------- Comment By: Berserker (berserker_r) Date: 2007-10-23 18:18 Message: Logged In: YES user_id=418740 Originator: YES 4 months and no patches yet...any hope? ---------------------------------------------------------------------- Comment By: soccia79 (soccia79) Date: 2007-10-23 11:28 Message: Logged In: YES user_id=1836240 Originator: NO Plz help! ---------------------------------------------------------------------- Comment By: soccia79 (soccia79) Date: 2007-10-22 11:47 Message: Logged In: YES user_id=1836240 Originator: NO I tried the la svn revision but the problem persists! Always the same cast error as berserker_r reported: SWIGEXPORT void SWIGSTDCALL CSharp_Alfa_testSwigExplicitAlfa(void *jarg1) { Alfa *arg1 = (Alfa *) 0 ; SwigDirector_Alfa *darg = 0; arg1 = (Alfa *)jarg1; darg = dynamic_cast<SwigDirector_Alfa *>(arg1); // crash here because arg1 is a SwigDirector_Beta instance (darg)->testSwigPublic(); } ---------------------------------------------------------------------- Comment By: Olly Betts (olly) Date: 2007-10-19 12:59 Message: Logged In: YES user_id=14972 Originator: NO This sounds like it could be related to bug#1735931 which has been fixed in SVN HEAD: http://sourceforge.net/tracker/index.php?func=detail&aid=1735931&group_id=1645&atid=101645 Can you check the latest SVN HEAD and let us know if this is fixed/still present? ---------------------------------------------------------------------- Comment By: soccia79 (soccia79) Date: 2007-10-19 10:47 Message: Logged In: YES user_id=1836240 Originator: NO Plz fix this bug! ---------------------------------------------------------------------- Comment By: soccia79 (soccia79) Date: 2007-07-26 15:42 Message: Logged In: YES user_id=1836240 Originator: NO News about this bug? ---------------------------------------------------------------------- Comment By: soccia79 (soccia79) Date: 2007-07-04 15:42 Message: Logged In: YES user_id=1836240 Originator: NO Plz fix this bug, I have the same problem!!! (I'm using last SVN) ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=101645&aid=1746818&group_id=1645 |