Custom memory manager and calling unref for Cairo::RefPtr<Cairo::Context>
- From: "Roman Yazmin" <roman yazmin gmail com>
- To: gtkmm-list gnome org
- Subject: Custom memory manager and calling unref for Cairo::RefPtr<Cairo::Context>
- Date: Thu, 17 Jul 2008 01:55:44 +0400
Hi everyone.
I'm using custom memory manager and operators like new and delete are overloaded.
Sample code:
bool MyDraw::on_expose_event(GdkEventExpose* event)
{
Glib::RefPtr<Gdk::Window> window = get_window();
if(window)
{
Cairo::RefPtr<Cairo::Context> cr = window->create_cairo_context();
}
}
When unref for Cairo::RefPtr<Cairo::Context> is called (cr goes out of scope)
I have a crash.
Crashing here: cairomm/refptr.h
template <class T_CppObject> inline
void RefPtr<T_CppObject>::unref()
{
if(pCppRefcount_)
{
--(*pCppRefcount_);
if(*pCppRefcount_ == 0)
{
if(pCppObject_)
{
delete pCppObject_;
pCppObject_ = 0;
}
delete pCppRefcount_; //<<<<<<------------------------- crash here, (in my overloaded delete operator, he can't found some internal information and assertion happens )
pCppRefcount_ = 0;
}
}
}
As I understand, pCppRefcount is allocated not with my overloaded new operator.
It seems like it is allocated somewhere by create_cairo_context() method.
I am using Windows platform, and allocating memory in DLL and free it
in host application is not good idea, especially with different allocation methods.
Is any idea how to resolve this issue?
I'm still want to use my own memory manager for new/delete.
Thanks.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]