Closed
Bug 95711
Opened 24 years ago
Closed 10 years ago
free font when no longer in use
Categories
(Core :: Internationalization, defect)
Tracking
()
RESOLVED
WORKSFORME
People
(Reporter: bstell, Assigned: jshin1987)
References
Details
(Keywords: intl)
Attachments
(1 file, 6 obsolete files)
|
13.04 KB,
patch
|
Details | Diff | Splinter Review |
Fonts that are loaded are not released even when they are no longer in use.
We need to ref count the fonts and release them when the count goes to zero.
| Reporter | ||
Updated•24 years ago
|
Status: NEW → ASSIGNED
Target Milestone: --- → mozilla0.9.5
| Reporter | ||
Comment 1•24 years ago
|
||
| Reporter | ||
Comment 2•24 years ago
|
||
attachment 49313 [details] [diff] [review] frees the x/gdk font when not in use.
The node/nsFontGTK is otherwise not affected.
Katakai/Roland: could you look at this and see if it makes sense.
thanks
Comment 3•24 years ago
|
||
Two issues:
1. Is it guranteed that the font isn't freed while the GC-cache
(GTK+/Xlib/Xprint use GC caches) still has a GC cache entry which uses this font
?
2. Do you file a port to Xlib gfx or should I do that ?
| Reporter | ||
Comment 4•24 years ago
|
||
Roland: could you give me a pointer to where the GC cache accesses a font?
I'm not setup to test the Xlib code path. Would you mind creating a Xlib
patch and attaching it to this bug?
Comment 5•24 years ago
|
||
> Roland: could you give me a pointer to where the GC cache accesses a font?
See http://lxr.mozilla.org/seamonkey/source/gfx/src/xlib/nsGCCache.cpp and
http://lxr.mozilla.org/seamonkey/source/gfx/src/xlib/nsGCCache.h
The UpdateGC() method
(http://lxr.mozilla.org/seamonkey/source/gfx/src/xlib/nsRenderingContextXlib.cpp#480)
is responsible to get a matching GC entry for that font...
(GTK+ gfx code does the same except that it plays around with the silly GDK/GTK+
wrappers).
> I'm not setup to test the Xlib code path. Would you mind creating a Xlib
> patch and attaching it to this bug?
No problem...
"Now" or can I wait until the GTK+ version has been r='ed (and you're then
r='ing the Xlib version... :-) ?
| Reporter | ||
Comment 6•24 years ago
|
||
Roland: I would recommend waiting until we think the gtk version is stable
but then proceed before the r= is done.
| Reporter | ||
Comment 7•24 years ago
|
||
We probably need to increment/decrement the counters when a font is
put-in / removed-from a gc.
Comment 8•24 years ago
|
||
bstell wrote:
> Roland: I would recommend waiting until we think the gtk version is stable
> but then proceed before the r= is done.
OK!
----
bstell wrote:
> We probably need to increment/decrement the counters when a font is
> put-in / removed-from a gc.
I am not sure... if I remember correctly there is one GC-cache per |Drawable|.
If all objects which keep refs to the GC-cache are destroyed (which means that
the GC-cache will finally destroy itself) before the fonts get disposed then
we're safe... otherwise we need a way to track the use of fonts by the
GC-cache.
| Reporter | ||
Updated•24 years ago
|
Target Milestone: mozilla0.9.5 → mozilla0.9.6
Updated•24 years ago
|
QA Contact: andreasb → ylong
| Reporter | ||
Comment 9•24 years ago
|
||
We will need to add the "font" (nsXFont) to this so we can addref on
insert and decref on remove.
http://lxr.mozilla.org/seamonkey/source/gfx/src/xlib/nsGCCache.h#92
92 struct GCCacheEntryXlib
93 {
94 PRCList clist;
95 unsigned long flags;
96 XGCValues gcv;
97 Region clipRegion;
98 xGC *gc;
99 };
| Reporter | ||
Comment 10•24 years ago
|
||
| Reporter | ||
Comment 11•24 years ago
|
||
| Reporter | ||
Comment 12•24 years ago
|
||
Comment on attachment 56317 [details] [diff] [review]
the full diff (includes the changes from the ~4500 lines of bug 90813 attachment 55932 [details] [diff] [review])
patch does not like attachement 56317
Attachment #56317 -
Attachment is obsolete: true
| Reporter | ||
Comment 13•24 years ago
|
||
Comment on attachment 56317 [details] [diff] [review]
the full diff (includes the changes from the ~4500 lines of bug 90813 attachment 55932 [details] [diff] [review])
humm. now attachment 56317 [details] [diff] [review] works
Attachment #56317 -
Attachment is obsolete: false
| Reporter | ||
Updated•24 years ago
|
Target Milestone: mozilla0.9.6 → mozilla0.9.7
| Reporter | ||
Updated•24 years ago
|
Attachment #56317 -
Attachment is obsolete: true
| Reporter | ||
Comment 14•24 years ago
|
||
| Reporter | ||
Updated•24 years ago
|
Attachment #49313 -
Attachment is obsolete: true
| Reporter | ||
Updated•24 years ago
|
Target Milestone: mozilla0.9.8 → mozilla0.9.9
Comment 16•24 years ago
|
||
give to shanjian. please do nothing untill bstell land his truetype patch
remove target
Assignee: bstell → shanjian
Status: ASSIGNED → NEW
Target Milestone: mozilla0.9.9 → ---
| Reporter | ||
Comment 17•24 years ago
|
||
I don't mind working on this with you Shanjian.
Comment 18•24 years ago
|
||
brian, what's your plan for this? We probably do want to check in this for
machV.
Status: NEW → ASSIGNED
| Reporter | ||
Comment 19•24 years ago
|
||
Basically the code is in attachment 56315 [details].
It adds ref counting to the fonts.
Comment 20•24 years ago
|
||
Attachment #56315 -
Attachment is obsolete: true
Updated•24 years ago
|
Attachment #56827 -
Attachment is obsolete: true
Comment 21•24 years ago
|
||
Comment 22•24 years ago
|
||
bstell, would you mind take a look of the patch ?
Comment 23•24 years ago
|
||
Shanjian:
What about using |nsCOMPtr| for ref-tracking instead of using "home-grown" code
?
| Reporter | ||
Comment 24•24 years ago
|
||
Shanjian: thanks for working on this.
It has been a while since I last looked at this so I do not remember the
details.
Would it be possible for you to address these commented out lines?
+// gdk_font_unref(mFont);
+ //mXFont->UnloadFont();
+ //mXFont->UnloadFont();
Roland: do you intend to add gfx/xlib patches?
Comment 25•24 years ago
|
||
Attachment #89146 -
Attachment is obsolete: true
Attachment #89147 -
Attachment is obsolete: true
Comment 26•24 years ago
|
||
Brian Stell wrote:
> Roland: do you intend to add gfx/xlib patches?
Sure, if you say the GTK+ patch is OK for you... :)
Comment 27•24 years ago
|
||
Roland, I didn't use nsISupport is because reference count is the only thing we
need here, and we need to special handling dereference to release font any way.
| Reporter | ||
Comment 28•24 years ago
|
||
I talked to dbaron (and waterson). Both recommended not using nsCOMPtr since in
debug mode it checks if the code did a queryInterface and if the uuid is non-zero.
They both did however suggest using nsRefPtr,
http://lxr.mozilla.org/seamonkey/source/xpcom/base/nsAutoPtr.h#201.
http://lxr.mozilla.org/seamonkey/source/xpcom/tests/TestAutoPtr.cpp
David noted that he had not tried it on all systems and thus it may cause some
issue on the ports page but he said he would resolve these. Waterson felt that
moz developers should start using this.
Comment 29•24 years ago
|
||
I have no idea about how to use nsRefPtr. It looks like to me that nsISupport
need to be implemented before it will work. I don't see what is the point to use
that.
No, it only requires that the refcounting methods be called AddRef and Release.
That said, I should really add the test app for nsRefPtr to the build before
you try to use it in code. See bug 104346.
| Reporter | ||
Comment 31•24 years ago
|
||
> it only requires that the refcounting methods be called AddRef and Release.
Specifically this means adding nsRefPtr to nsFontGTK
-class nsFontGTK
+class nsFontGTK : nsRefPtr
and in the patch IncXFontRefCnt() changes to AddRef:
-inline void IncXFontRefCnt() { mXFontRefCnt++; };
+inline void AddRef() { mXFontRefCnt++; };
and DecXFontRefCnt() changes to Release()
-nsXFontAAScaledBitmap::DecXFontRefCnt()
+nsXFontAAScaledBitmap::Release()
(and all the other uses of these in the patch)
> -class nsFontGTK
> +class nsFontGTK : nsRefPtr
There's no need to do that. It will just increase the size of nsFontGTK by a
word and probably cause weird compilation errors.
Comment 33•21 years ago
|
||
shanjian is no longer working on mozilla for 2 years and these bugs are still
here. Mark them won't fix. If you want to reopen it, find a good owner first.
Status: ASSIGNED → RESOLVED
Closed: 21 years ago
Resolution: --- → WONTFIX
Comment 35•21 years ago
|
||
Mass Re-opening Bugs Frank Tang Closed on Wensday March 02 for no reason, all
the spam is his fault feel free to tar and feather him
Status: RESOLVED → REOPENED
Resolution: WONTFIX → ---
Comment 36•21 years ago
|
||
Reassigning Franks old bugs to Jungshik Shin for triage - Sorry for spam
Assignee: nobody → jshin1987
Status: REOPENED → NEW
Updated•16 years ago
|
QA Contact: amyy → i18n
Comment 37•10 years ago
|
||
The code changed by the patch no longer exists. I think the font code under gfx/thebes/
now implements what this bug requested.
Status: NEW → RESOLVED
Closed: 21 years ago → 10 years ago
Resolution: --- → WORKSFORME
You need to log in
before you can comment on or make changes to this bug.
Description
•