Xref: utzoo comp.windows.open-look:287 alt.toolkits.xview:78 Path: utzoo!mnetor!geac!torsqnt!news-server.csri.toronto.edu!cs.utexas.edu!uunet!shearson.com!newshost!salc From: salc@aristotle.shearson.com (Sal Cataudella) Newsgroups: comp.windows.open-look,alt.toolkits.xview Subject: Re: XView with C++ Message-ID: Date: 18 Dec 90 18:11:16 GMT References: Sender: news@shearson.com (News) Distribution: all Organization: Lehman Brothers Lines: 63 In-Reply-To: salc@aristotle.shearson.com's message of 18 Dec 90 11:50:1 In article salc@aristotle.shearson.com (Sal Cataudella) writes: Xref: shearson.com comp.windows.open-look:260 alt.toolkits.xview:69 Newsgroups: comp.windows.open-look,alt.toolkits.xview Path: shearson.com!newshost!salc From: salc@aristotle.shearson.com (Sal Cataudella) Sender: news@shearson.com (News) Organization: Lehman Brothers References: Distribution: all Date: 18 Dec 90 11:50:12 In article zoo@aps1.spa.umn.edu (david d [zoo] zuhn) writes: Xref: shearson.com comp.windows.open-look:259 alt.toolkits.xview:68 Path: shearson.com!uunet!know!cs.utexas.edu!swrinde!elroy.jpl.nasa.gov!ncar!gatech!mcnc!shelby!msi.umn.edu!s16.msi.umn.edu!zoo From: zoo@aps1.spa.umn.edu (david d [zoo] zuhn) Newsgroups: comp.windows.open-look,alt.toolkits.xview Date: 16 Dec 90 07:17:13 GMT Sender: news@s1.msi.umn.edu Distribution: all Organization: Minnesota Automated Plate Scanner Lab Lines: 103 [ Description of problem and source code follows...] david d [zoo] zuhn Univ. of Minnesota Dept. of Astronomy zoo@aps1.spa.umn.edu Automated Plate Scanner Project > david the problem is very simple, your quit method is being invoked with a > garbage 'this' pointer. As a result when your test::quit() method tries to > access data members it is offsetting from *garbage*. Actually the reason for the core dump is because a method pointer is not just a plain function pointer, it is actually a structure which contains various other information as well. You cannot cast a method pointer to a plain function pointer and expect it to work... The rest of the suggestion is valid Taking the address of the method you want to call back is *not* enough;To callback the method you need to associate it with an object pointer. Suggestion: create a generic callback function that can take as parameters the pointer to the method and the pointer to the object, then execute the method in the context of the specific object. Current C based toolkits are not setup to handle calling back C++ methods. You have to provide the interface which does this. -- Sal Cataudella Internet: salc@sisyphus.shearson.com UUCP: ...!uunet!slcpi!sisyphus!salc (212) 464-8728 -- Sal Cataudella Internet: salc@sisyphus.shearson.com UUCP: ...!uunet!slcpi!sisyphus!salc (212) 464-8728