Please take our Survey
logo       

Choosing A Webhost:
A web hosting service is a type of Internet hosting service that allows individuals and organizations to provide their own website accessible via the World Wide Web. Web hosts are companies that provide space on a server they own for use by their clients as well as providing Internet connectivity, typically in a data center. Web hosts can also provide data center space and connectivity to the Internet for servers they do not own to be located in their data center, called colocation. more...

Re: Wrapping wxArtProvider class: msg#00023

lang.perl.wxperl

Subject: Re: Wrapping wxArtProvider class

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

Attachment: wx-artprov-4.patch.gz
Description: GNU Zip compressed data

<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
qplus.devel/200...    network.jabber....    debian.qa-packa...    encryption.gpg....    python.dabo.dev...    uclinux.devel/2...    science.mathema...    recreation.pesc...    kernel.ck/2004-...    mozilla.devel.e...    tex.latex.prosp...    ietf.multi6/200...    bbc.cvs/2002-11...    xfree86.newbie/...    jakarta.taglibs...    altlinux.hardwa...    comedi/2002-05/...    horde.bugs/2004...    games.diplomacy...    finance.e-gold....    web.dom.test-su...    lang.ruby.rails...    os.netbsd.devel...    video.gstreamer...   
Home | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive 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

Navigation