Closed
Bug 361592
Opened 19 years ago
Closed 19 years ago
fix gfx*Surface <-> cairo_surface_t refcounting issues
Categories
(Core :: Graphics, defect)
Tracking
()
RESOLVED
FIXED
People
(Reporter: vlad, Assigned: vlad)
References
Details
Attachments
(1 file)
|
18.26 KB,
patch
|
pavlov
:
review+
|
Details | Diff | Splinter Review |
We need to fix this once and for all; the right fix is:
- cairo_surface_t's refcount becomes the main one
- gfxASurface needs to have its own addref/release impl that chains to cairo_surface_reference/_destroy.
- we need a destructor added to userdata (the gfxASurface wrapper) on cairo_surface_t that deletes the wrapper when it goes out of scope.
Updated•19 years ago
|
| Assignee | ||
Comment 1•19 years ago
|
||
Ok, here we go. This ties the surface wrapper refcount directly to the cairo refcount. When we create a wrapper, we store it as user data on the surface and it's only destroyed when the cairo surface is destroyed.
There is only one tricky thing here, and that is that cairo surfaces are always returned with a refcount of 1, unlike our objects which are returned with a refcount of 0 (and expect the caller to addref right away). So, when we created the cairo surface, we track that phantom extra ref and just ignore the first call to AddRef.
Attachment #250402 -
Flags: review?(pavlov)
| Assignee | ||
Comment 2•19 years ago
|
||
Comment on attachment 250402 [details] [diff] [review]
tie wrapper refcount to cairo refcount
>@@ -135,22 +163,18 @@ protected:
> static gfxASurface* GetSurfaceWrapper(cairo_surface_t *csurf);
> static void SetSurfaceWrapper(cairo_surface_t *csurf, gfxASurface *asurf);
>
>+ gfxASurface () : mTrackThis(PR_FALSE) { }
>+ PRPackedBool mTrackThis;
>+
Ignore this, I added this while doing some tracking stuff, but I took out all the other code related to it. I'll delete this part from my patch.
Updated•19 years ago
|
Attachment #250402 -
Flags: review?(pavlov) → review+
Comment 3•19 years ago
|
||
So.. my build is dying due to this change:
gfxSurfaceRefCountTest.cpp
ld: warning: libmozz.so, needed by ../../../dist/bin/libthebes.so, not found (try using -rpath or -rpath-link)
../../../dist/bin/libthebes.so: undefined reference to `MOZ_Z_compress'
collect2: ld returned 1 exit status
gmake[6]: *** [gfxSurfaceRefCountTest] Error 1
| Assignee | ||
Updated•19 years ago
|
Status: NEW → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•