Open Bug 1437727 Opened 6 years ago Updated 2 years ago

Disabling C++ unification triggers build error for ServoKeyframesRule.h: "RefPtr.h:41:9: error: member access into incomplete type 'mozilla::ServoKeyframeDeclaration'"

Categories

(Core :: CSS Parsing and Computation, defect, P5)

defect

Tracking

()

People

(Reporter: dholbert, Unassigned)

References

Details

Attachments

(2 files)

When I build with unification disabled in layout/style (e.g. via the 'for reference' patch attached to bug 1437723), I get this build error:

=======
 In file included from ../../../mozilla/layout/style/ServoKeyframesRule.cpp:7:
 In file included from ../../dist/include/mozilla/ServoKeyframesRule.h:10:
 In file included from ../../dist/include/mozilla/dom/CSSKeyframesRule.h:10:
 In file included from ../../dist/include/mozilla/css/GroupRule.h:16:
 In file included from ../../dist/include/mozilla/ErrorResult.h:31:
 In file included from ../../dist/include/js/Value.h:23:
 In file included from ../../dist/include/js/RootingAPI.h:13:
 In file included from ../../dist/include/mozilla/LinkedList.h:71:
 ../../dist/include/mozilla/RefPtr.h:41:9: error: member access into incomplete type 'mozilla::ServoKeyframeDeclaration'
     aPtr->Release();
         ^
 ../../dist/include/mozilla/RefPtr.h:398:33: note: in instantiation of member function 'mozilla::RefPtrTraits<mozilla::ServoKeyframeDeclaration>::Release' requested here
       mozilla::RefPtrTraits<U>::Release(aPtr);
                                 ^
 ../../dist/include/mozilla/RefPtr.h:79:37: note: in instantiation of member function 'RefPtr<mozilla::ServoKeyframeDeclaration>::ConstRemovingRefPtrTraits<mozilla::ServoKeyframeDeclaration>::Release' requested here
       ConstRemovingRefPtrTraits<T>::Release(mRawPtr);
                                     ^
 ../../dist/include/mozilla/ServoKeyframeRule.h:23:3: note: in instantiation of member function 'RefPtr<mozilla::ServoKeyframeDeclaration>::~RefPtr' requested here
   ServoKeyframeRule(already_AddRefed<RawServoKeyframe> aRaw,
   ^
 ../../dist/include/mozilla/ServoKeyframeRule.h:18:7: note: forward declaration of 'mozilla::ServoKeyframeDeclaration'
 class ServoKeyframeDeclaration;
       ^
 1 error generated.
=======


I think this is because ServoKeyframesRule.h has a RefPtr<ServoKeyframeDeclaration> member-variable, without having provided the definition for ServoKeyframeDeclaration.  It does have a forward-declaration, but that's not sufficient for a RefPtr variable -- IIRC, RefPtr<Foo> expands to the full definition of the RefPtr class (effectively), which includes calls to Foo::Release, which means it needs to know the definition for class Foo.

So if we have a RefPtr<ServoKeyframeDeclaration> variable here, we need to have ServoKeyframeDeclaration defined before that (probably in a header).

Unfortunately this ServoKeyframeDeclaration class is defined in a .cpp file right now, so there's no one-liner fix to just add some header here. I think maybe the simplest solution might be to move it from its current home into a .h file that we can include...?
Priority: -- → P5
Version: 57 Branch → Trunk
As indicated by the two attached patches, it seems we currently (inadvertantly) depend on these two files being unified together:
  ServoKeyframeRule.cpp
  ServoKeyframesRule.cpp
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: