Closed
Bug 374598
Opened 17 years ago
Closed 17 years ago
simplify filter property destruction
Categories
(Core :: SVG, defect)
Core
SVG
Tracking
()
RESOLVED
DUPLICATE
of bug 377149
People
(Reporter: longsonr, Assigned: longsonr)
Details
Attachments
(1 file, 2 obsolete files)
6.05 KB,
patch
|
Details | Diff | Splinter Review |
No description provided.
Attachment #259089 -
Flags: review?(jwatt)
Comment 1•17 years ago
|
||
Comment on attachment 259089 [details] [diff] [review] patch How about also setting NS_STATE_SVG_FILTERED in the ctor so it can be removed from AddEffectProperties, and... >@@ -996,25 +994,20 @@ nsSVGUtils::StyleEffects(nsIFrame *aFram > { > nsFrameState state = aFrame->GetStateBits(); > > /* clear out all effects */ > > if (state & NS_STATE_SVG_CLIPPED_MASK) { > aFrame->DeleteProperty(nsGkAtoms::clipPath); > } > > if (state & NS_STATE_SVG_FILTERED) { >- nsSVGFilterProperty *property; >- property = NS_STATIC_CAST(nsSVGFilterProperty *, >- aFrame->GetProperty(nsGkAtoms::filter)); >- if (property) >- property->RemoveMutationObserver(); > aFrame->DeleteProperty(nsGkAtoms::filter); > } > > if (state & NS_STATE_SVG_MASKED) { > aFrame->DeleteProperty(nsGkAtoms::mask); > } > > aFrame->RemoveStateBits(NS_STATE_SVG_CLIPPED_MASK | > NS_STATE_SVG_FILTERED | > NS_STATE_SVG_MASKED); ...removing NS_STATE_SVG_FILTERED from here since it will be removed by the DeleteProperty. That way the setting and clearing of NS_STATE_SVG_FILTERED is fully encapsulated within nsSVGFilterProperty.
Comment 2•17 years ago
|
||
Oh, and please make the dtor virtual.
Assignee | ||
Comment 3•17 years ago
|
||
(In reply to comment #1) > (From update of attachment 259089 [details] [diff] [review]) > How about also setting NS_STATE_SVG_FILTERED in the ctor so it can be removed > from AddEffectProperties, and... Good idea. I added in the other creation guff from AddEffectProperties too. > ...removing NS_STATE_SVG_FILTERED from here since it will be removed by the > DeleteProperty. That way the setting and clearing of NS_STATE_SVG_FILTERED is > fully encapsulated within nsSVGFilterProperty. > Done, although it doesn't cost us anything. I hope that won't confuse anyone looking at the code later wondering why we only clear 2/3 flags.
Assignee: general → longsonr
Attachment #259089 -
Attachment is obsolete: true
Status: NEW → ASSIGNED
Attachment #259095 -
Flags: review?(jwatt)
Attachment #259089 -
Flags: review?(jwatt)
Comment 4•17 years ago
|
||
Are we sure that aFrame->DeleteProperty will definitely result in the object being deleted immediately? Even if API stuff changes in future? I'm not sure that DeleteProperty necessarily means a property will be freed. Perhaps it's likely to be seen by others (in future) to only mean "remove from the element"? I'd like to look at this more closely, but I have to head out right now.
Assignee | ||
Comment 5•17 years ago
|
||
(In reply to comment #4) > Are we sure that aFrame->DeleteProperty will definitely result in the object > being deleted immediately? Even if API stuff changes in future? I'm not sure > that DeleteProperty necessarily means a property will be freed. Perhaps it's > likely to be seen by others (in future) to only mean "remove from the element"? > I'd like to look at this more closely, but I have to head out right now. > We ensure immediate destruction by the way we call SetProperty in the nsSVGFilterProperty constructor. It passes in a pointer to itself as the destructor function to call when DeleteProperty is called. This is documented as part of the nsINode.h API. If someone changes the API to have different semantics to those currently described in the .h file they will have to change the callers too.
Comment 6•17 years ago
|
||
Comment on attachment 259095 [details] [diff] [review] address review comments nsSVGFilterProperty::nsSVGFilterProperty(nsISVGFilterFrame *aFilter, > nsIFrame *aFrame) > : mFilter(aFilter), mFrame(aFrame) > { >+ NS_ADDREF(this); // addref to allow QI - FilterPropertyDtor releases FilterPropertyDtor no longer exists. It should be nsPropertyTable::SupportsDtorFunc. Also I'm not sure I'm too keen on moving the addref into the ctor. (In reply to comment #5) > We ensure immediate destruction by the way we call SetProperty in the > nsSVGFilterProperty constructor. It passes in a pointer to itself as the > destructor function to call when DeleteProperty is called. What we pass in to use as the destructor is nsPropertyTable::SupportsDtorFunc. Therefore all we ensure is immediate _release_, which doesn't necessarily mean immediate destruction if something else ends up holding a reference to the property (say due to future code changes?)
Comment 7•17 years ago
|
||
I actually can't seen any reason for nsSVGFilterProperty to implement nsISupports. Maybe that should be removed and we should bring back FilterPropertyDtor. I'm really not familiar with the filter code so I don't know why that was killed in the first place. Maybe tor knows.
Assignee | ||
Comment 8•17 years ago
|
||
(In reply to comment #7) > I actually can't seen any reason for nsSVGFilterProperty to implement > nsISupports. Maybe that should be removed and we should bring back > FilterPropertyDtor. I'm really not familiar with the filter code so I don't > know why that was killed in the first place. Maybe tor knows. > Bug 359516 comment 14
Assignee | ||
Comment 9•17 years ago
|
||
I'd like to iron out some differences between the marker and filter listener code. Either by modifying the marker code not to use a destructor or the filter code to have one (see previous patch). Which way would you like to go?
Attachment #261455 -
Flags: review?(tor)
Assignee | ||
Updated•17 years ago
|
Attachment #259095 -
Flags: review?(jwatt)
Comment 10•17 years ago
|
||
How is this patch simplifying destruction? It seems that by moving code out of the constructor and destructor you've made things more complicated and fragile for the users.
Assignee | ||
Updated•17 years ago
|
Attachment #261455 -
Attachment is obsolete: true
Attachment #261455 -
Flags: review?(tor)
Assignee | ||
Updated•17 years ago
|
Status: ASSIGNED → RESOLVED
Closed: 17 years ago
Resolution: --- → DUPLICATE
You need to log in
before you can comment on or make changes to this bug.
Description
•