Closed Bug 854507 Opened 11 years ago Closed 11 years ago

Build error when compiling widget/gtk2/nsWidgetFactory.cpp: "In instantiation of 'nsCOMPtr<T>::~nsCOMPtr() [with T = nsIContent]': ... error: invalid use of incomplete type 'class nsIContent'

Categories

(Core :: Widget: Gtk, defect)

x86_64
Linux
defect
Not set
normal

Tracking

()

VERIFIED DUPLICATE of bug 854115

People

(Reporter: dholbert, Unassigned)

Details

Attachments

(1 file)

Build error for my local mozilla-inbound debug build today, when compiling widget/gtk2/nsWidgetFactory.cpp:
{
In file included from ../../dist/include/mozilla/Module.h:12:0,
                 from ../../dist/include/mozilla/ModuleUtils.h:10,
                 from /scratch/work/builds/mozilla-inbound/mozilla/widget/gtk2/nsWidgetFactory.cpp:8:
../../dist/include/nsCOMPtr.h: In instantiation of 'nsCOMPtr<T>::~nsCOMPtr() [with T = nsIContent]':
../../dist/include/nsTArray.h:439:5:   required from 'static void nsTArrayElementTraits<E>::Destruct(E*) [with E = nsCOMPtr<nsIContent>]'
../../dist/include/nsTArray.h:1304:33:   required from 'void nsTArray_Impl<E, Alloc>::DestructRange(nsTArray_Impl<E, Alloc>::index_type, nsTArray_Impl<E, Alloc>::size_type) [with E = nsCOMPtr<nsIContent>; Alloc = nsTArrayInfallibleAllocator; nsTArray_Impl<E, Alloc>::index_type = unsigned int; nsTArray_Impl<E, Alloc>::size_type = unsigned int]'
../../dist/include/nsTArray.h:1023:31:   required from 'void nsTArray_Impl<E, Alloc>::RemoveElementsAt(nsTArray_Impl<E, Alloc>::index_type, nsTArray_Impl<E, Alloc>::size_type) [with E = nsCOMPtr<nsIContent>; Alloc = nsTArrayInfallibleAllocator; nsTArray_Impl<E, Alloc>::index_type = unsigned int; nsTArray_Impl<E, Alloc>::size_type = unsigned int]'
../../dist/include/nsTArray.h:1034:33:   required from 'void nsTArray_Impl<E, Alloc>::Clear() [with E = nsCOMPtr<nsIContent>; Alloc = nsTArrayInfallibleAllocator]'
../../dist/include/nsTArray.h:519:28:   required from 'nsTArray_Impl<E, Alloc>::~nsTArray_Impl() [with E = nsCOMPtr<nsIContent>; Alloc = nsTArrayInfallibleAllocator]'
../../dist/include/nsTArray.h:1377:7:   required from here
../../dist/include/nsCOMPtr.h:492:88: error: invalid static_cast from type 'nsIContent*' to type 'nsISupports*'
           NSCAP_LOG_RELEASE(this, mRawPtr);
                                                                                        ^
../../dist/include/nsCOMPtr.h:494:13: error: invalid use of incomplete type 'class nsIContent'
             NSCAP_RELEASE(this, mRawPtr);
             ^
In file included from ../../dist/include/nsIWidget.h:19:0,
                 from /scratch/work/builds/mozilla-inbound/mozilla/widget/gtk2/../xpwidgets/nsBaseWidget.h:10,
                 from /scratch/work/builds/mozilla-inbound/mozilla/widget/gtk2/nsWidgetFactory.cpp:12:
../../dist/include/nsITheme.h:25:7: error: forward declaration of 'class nsIContent'
 class nsIContent;
}

I can fix it by just #including nsIContent.h in nsWidgetFactory.cpp.

I'll bet someone removed an #include in a header that nsWidgetFactory.cpp was inadvertantly depending on for the nsIContent class definition, or something.

(Not sure why this isn't burning TBPL; maybe it's got some platform/config-specific aspects.)
Attached patch fix?Splinter Review
This fixes it, but I'm actually not sure where the nsCOMPtr<nsIContent> in question is declared. I just noticed that nsWidgetFactory itself doesn't even mention nsIContent.
Duping to a newer bug becase it has r+ already. Hopefully that is fine.
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → DUPLICATE
Yup, thanks!
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: