Memory leak of RefPtr?
- From: "Rose Cumming" <rose_alice_cumming hotmail com>
- To: gtkmm-list gnome org
- Subject: Memory leak of RefPtr?
- Date: Thu, 24 Aug 2006 20:11:23 +0000
Hello,
I'm not familiar with smart pointer. I'm just wondering will the following
code cause memory leak?
For example,
in my class, I have a member variable
Glib::RefPtr<Gdk::Pixbuf> viewBuffer_;
in the constructor of this class I do this,
viewBuffer_ = Gdk::Pixbuf::create(Gdk::COLORSPACE_RGB, false, 8, 100, 100);
in a member function of this class I do this,
void draw()
{
Glib::RefPtr<Gdk::Pixbuf> *buffer;
someObjectPointer_->getImage(&buffer);
viewBuffer_ = (*buffer)->scale_simple(100,100,Gdk::INTERP_BILINEAR);
}
Say draw is called somewhere in my application.
An only one object of this class is kept in my application.
The question is, will this
viewBuffer_ = (*buffer)->scale_simple(100,100,Gdk::INTERP_BILINEAR);
cause memory leak?
Or there're "better" (proper) way to unref the smart pointer or something?
Thank you
Rose
_________________________________________________________________
Play Q6 for your chance to WIN great prizes.
http://q6trivia.imagine-live.com/enca/landing
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]