Closed
Bug 334612
Opened 19 years ago
Closed 19 years ago
Crash when using select1
Categories
(Core Graveyard :: XForms, defect)
Core Graveyard
XForms
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: allan, Assigned: allan)
References
()
Details
(Keywords: crash, fixed1.8.0.5, fixed1.8.1)
Attachments
(1 file, 1 obsolete file)
6.30 KB,
patch
|
doronr
:
review+
|
Details | Diff | Splinter Review |
I get some crashes when using select1s on trunk. 99% sure a regression from bug 313118.
Assignee | ||
Comment 1•19 years ago
|
||
I was a bit to eager to RebindToModel() on document/parent changes. We should detach from the current model alright, but there's no need to try to Bind() again if there's no parent or document.
I've also added a few sanity-checks to related parts.
Comment 2•19 years ago
|
||
Comment on attachment 218961 [details] [diff] [review]
Patch
>? rebind.patch
>Index: nsXFormsControlStub.cpp
>===================================================================
>RCS file: /cvsroot/mozilla/extensions/xforms/nsXFormsControlStub.cpp,v
>retrieving revision 1.43
>diff -u -p -U8 -r1.43 nsXFormsControlStub.cpp
>--- nsXFormsControlStub.cpp 19 Apr 2006 08:22:28 -0000 1.43
>+++ nsXFormsControlStub.cpp 19 Apr 2006 09:31:37 -0000
>@@ -235,28 +235,36 @@ nsXFormsControlStubBase::GetUsesModelBin
> }
>
> nsresult
> nsXFormsControlStubBase::MaybeAddToModel(nsIModelElementPrivate *aOldModel,
> nsIXFormsControl *aParent)
> {
> // XXX: just doing pointer comparison would be nice....
> PRBool sameModel = PR_FALSE;
>- nsCOMPtr<nsIDOM3Node> n3Model(do_QueryInterface(mModel));
>- nsCOMPtr<nsIDOMNode> nOldModel(do_QueryInterface(aOldModel));
>- NS_ASSERTION(n3Model, "model element not supporting nsIDOM3Node?!");
>- nsresult rv = n3Model->IsSameNode(nOldModel, &sameModel);
>- NS_ENSURE_SUCCESS(rv, rv);
>+ nsresult rv;
>+
>+ if (mModel) {
>+ nsCOMPtr<nsIDOM3Node> n3Model(do_QueryInterface(mModel));
>+ nsCOMPtr<nsIDOMNode> nOldModel(do_QueryInterface(aOldModel));
>+ NS_ASSERTION(n3Model, "model element not supporting nsIDOM3Node?!");
>+ rv = n3Model->IsSameNode(nOldModel, &sameModel);
>+ NS_ENSURE_SUCCESS(rv, rv);
>+ } else {
>+ sameModel = aOldModel ? PR_TRUE : PR_FALSE;
>+ }
Why sameModel is PR_TRUE if aOldModel but not mModel ?
Assignee | ||
Comment 3•19 years ago
|
||
(In reply to comment #2)
> (From update of attachment 218961 [details] [diff] [review] [edit])
> >+ if (mModel) {
> >+ nsCOMPtr<nsIDOM3Node> n3Model(do_QueryInterface(mModel));
> >+ nsCOMPtr<nsIDOMNode> nOldModel(do_QueryInterface(aOldModel));
> >+ NS_ASSERTION(n3Model, "model element not supporting nsIDOM3Node?!");
> >+ rv = n3Model->IsSameNode(nOldModel, &sameModel);
> >+ NS_ENSURE_SUCCESS(rv, rv);
> >+ } else {
> >+ sameModel = aOldModel ? PR_TRUE : PR_FALSE;
> >+ }
>
> Why sameModel is PR_TRUE if aOldModel but not mModel ?
Because I am a clown, is that a good enough reason? :-) Yes, the other way around.
Comment 4•19 years ago
|
||
Comment on attachment 218961 [details] [diff] [review]
Patch
Well, if you're a clown and change that, r=me :)
Attachment #218961 -
Flags: review?(Olli.Pettay) → review+
Assignee | ||
Comment 5•19 years ago
|
||
That should take the circus out of it
Attachment #218961 -
Attachment is obsolete: true
Attachment #218991 -
Flags: review?(doronr)
Comment 6•19 years ago
|
||
Comment on attachment 218991 [details] [diff] [review]
declownified patch
>? attachment.cgi?id=218961
>? cirque.patch
>Index: nsXFormsControlStub.cpp
>===================================================================
>RCS file: /cvsroot/mozilla/extensions/xforms/nsXFormsControlStub.cpp,v
>retrieving revision 1.43
>diff -u -p -U8 -r1.43 nsXFormsControlStub.cpp
>--- nsXFormsControlStub.cpp 19 Apr 2006 08:22:28 -0000 1.43
>+++ nsXFormsControlStub.cpp 19 Apr 2006 14:16:33 -0000
>@@ -235,28 +235,36 @@ nsXFormsControlStubBase::GetUsesModelBin
> }
>
> nsresult
> nsXFormsControlStubBase::MaybeAddToModel(nsIModelElementPrivate *aOldModel,
> nsIXFormsControl *aParent)
> {
> // XXX: just doing pointer comparison would be nice....
> PRBool sameModel = PR_FALSE;
>- nsCOMPtr<nsIDOM3Node> n3Model(do_QueryInterface(mModel));
>- nsCOMPtr<nsIDOMNode> nOldModel(do_QueryInterface(aOldModel));
>- NS_ASSERTION(n3Model, "model element not supporting nsIDOM3Node?!");
>- nsresult rv = n3Model->IsSameNode(nOldModel, &sameModel);
>- NS_ENSURE_SUCCESS(rv, rv);
>+ nsresult rv;
>+
>+ if (mModel) {
>+ nsCOMPtr<nsIDOM3Node> n3Model(do_QueryInterface(mModel));
>+ nsCOMPtr<nsIDOMNode> nOldModel(do_QueryInterface(aOldModel));
>+ NS_ASSERTION(n3Model, "model element not supporting nsIDOM3Node?!");
>+ rv = n3Model->IsSameNode(nOldModel, &sameModel);
>+ NS_ENSURE_SUCCESS(rv, rv);
>+ } else {
>+ sameModel = !aOldModel;
>+ }
> if (!sameModel) {
> if (aOldModel) {
> rv = aOldModel->RemoveFormControl(this);
> NS_ENSURE_SUCCESS(rv, rv);
> }
>- rv = mModel->AddFormControl(this, aParent);
>- NS_ENSURE_SUCCESS(rv, rv);
>+ if (mModel) {
>+ rv = mModel->AddFormControl(this, aParent);
>+ NS_ENSURE_SUCCESS(rv, rv);
>+ }
> }
only nit - would be nice to have a newline after the if {} else{} block and the next if{} :)
Attachment #218991 -
Flags: review?(doronr) → review+
Assignee | ||
Comment 7•19 years ago
|
||
Fixed on trunk.
Status: ASSIGNED → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
Whiteboard: xf-to-branch
Assignee | ||
Updated•19 years ago
|
Keywords: fixed1.8.1
Assignee | ||
Updated•19 years ago
|
Keywords: fixed1.8.0.5
Assignee | ||
Updated•19 years ago
|
Whiteboard: xf-to-branch
Updated•9 years ago
|
Product: Core → Core Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•