|
|
Choosing A Webhost: |
Re: Wrapping wxArtProvider class: msg#00023lang.perl.wxperl
I've made a lot of progress on my wrapping of wxArtProvider. It is in fact almost complete. However, there's one nagging problem regarding the perl callbacks. I'm having issues with wxSize objects getting double deleted somewhere in the call to wxArtProvider::CreateBitmap. As near as I can tell, what happens is: 1) Perl code calls Wx::ArtProvider::GetBitmap. 2) XS code for Wx::ArtProvider::GetBitmap makes a wxSize object from either the parameter passed, or from wxDefaultSize. 3) XS code calls down to wxArtProvider::GetBitmap 4) In the guts of here, a call is made out to wxPlArtProvider::CreateBitmap, passing the wxSize object along 5) The XS for wxPlArtProvider::CreateBitmap creates a Wx::Size object to pass on to the perl code 6) The perl code does its thing 7) The Wx::Size object created in #5 goes out of scope, and the underlying wxSize object gets destroyed 8) Call frames finish and we end up back in the XS for Wx::ArtProvider::GetBitmap 9) This code delets the same underlying wxSize object again 10) Reams of warnings from glibc about free()ing invalid pointers are emitted as this chain of events repeats. I can work around this by allocating a copy of the size on the heap in the XS for Wx::ArtProvider::CreateBitmap and then letting / assuming that it will be deleted by perl, but somehow this seems dirty. But if it's the right way to go, then I guess the attached patch is okay. Attached is a patch against 0.22 with my progress so far. Other than the problem described here, it seems to work for all the static functions of wxArtProvider, and for deriving your own provider from Wx::PlArtProvider. To demonstrate the latter, I added an artprov sample based on the minimal sample from wxPerl and the artprov sample from wxWidgets. As an aside, the build process for my code, and for XS/PlWindow.xsp leaves the .h files they generate in cpp/ even after a make realclean. What's the proper way to fix this? -- -- Cheetah
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Wrapping wxArtProvider class, Cheetah |
|---|---|
| Next by Date: | Re:Re: Wrapping wxArtProvider class, mattia.barbon@xxxxxxxxx |
| Previous by Thread: | Wrapping wxArtProvider class, Cheetah |
| Next by Thread: | Re:Re: Wrapping wxArtProvider class, mattia.barbon@xxxxxxxxx |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
Free MagazinesCisco NewsReceive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business. subscribe Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field. subscribe The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business. subscribe Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company. subscribe Total Telecom Total Telecom is "The Economist of the communications industry". subscribe |