Bug 8511

Summary: RefPtr: refcounting broken with cast_*() methods.
Product: cairomm Reporter: Murray Cumming <murrayc>
Component: GeneralAssignee: Murray Cumming <murrayc>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: high    
Version: unspecified   
Hardware: x86 (IA32)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments: cairomm_refptr_cast_refcount.patch

Description Murray Cumming 2006-10-05 06:29:11 UTC
This patch fixes the problem, but it adds an ugly public constructor. Any ideas
for how to avoid that?
Comment 1 Murray Cumming 2006-10-05 06:30:02 UTC
Created attachment 7269 [details] [review]
cairomm_refptr_cast_refcount.patch

2006-10-05  Murray Cumming  <murrayc@murrayc.com>

	* cairomm/refptr.h: Added RefPtr(object, refcount) constructor
	for use in cast_*(), so that the casted RefPtr shares the same
	refcount, avoiding an early deletion. I do not like making
	this constructor public, but I do not see another way.
Comment 2 Jonathon Jongsma 2006-10-05 20:28:20 UTC
Ugh.  That *is* ugly, isn't it?  I racked my brain for a while tonight trying to
think of other ways to do it, but I haven't come up with anything yet.  I'll
keep thinking though.
Comment 3 Jonathon Jongsma 2007-07-14 10:26:44 UTC
committed.  Will be in version 1.4.2

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.