Last Comment Bug 676842 - nsTextEditorState.h should include nsString.h
: nsTextEditorState.h should include nsString.h
Status: RESOLVED FIXED
:
Product: Core
Classification: Components
Component: Layout: Form Controls (show other bugs)
: unspecified
: x86_64 Linux
: -- normal (vote)
: mozilla8
Assigned To: arno renevier
:
Mentors:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-08-05 08:31 PDT by arno renevier
Modified: 2011-08-09 08:58 PDT (History)
3 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
patch (859 bytes, patch)
2011-08-05 08:40 PDT, arno renevier
no flags Details | Diff | Review
updated patch: make nsTextEditorState.h first include of nsTextEditorState.cpp (2.23 KB, patch)
2011-08-05 11:58 PDT, arno renevier
ehsan: review+
Details | Diff | Review

Description arno renevier 2011-08-05 08:31:08 PDT
Hi,
When trying to include nsTextEditorState.h in a file which does not include (directly or indirectly nsString.h), compilation fails:
/home/arno/mozilla/content/html/content/src/nsTextEditorState.h:269:13: error: ‘nsCString’ was not declared in this scope
/home/arno/mozilla/content/html/content/src/nsTextEditorState.h:269:22: error: template argument 1 is invalid
/home/arno/mozilla/content/html/content/src/nsTextEditorState.h:271:11: error: ‘nsString’ does not name a type
/home/arno/mozilla/content/html/content/src/nsTextEditorState.h: In member function ‘void nsTextEditorState::EmptyValue()’:
/home/arno/mozilla/content/html/content/src/nsTextEditorState.h:163:41: error: base operand of ‘->’ is not a pointer
/home/arno/mozilla/content/html/content/src/nsTextEditorState.h: In member function ‘PRBool nsTextEditorState::IsEmpty() const’:
/home/arno/mozilla/content/html/content/src/nsTextEditorState.h:164:50: error: base operand of ‘->’ is not a pointer
/home/arno/mozilla/content/html/content/src/nsTextEditorState.h: In member function ‘void nsTextEditorState::ClearValueCache()’:
/home/arno/mozilla/content/html/content/src/nsTextEditorState.h:213:28: error: ‘mCachedValue’ was not declared in this scope
Comment 1 arno renevier 2011-08-05 08:40:40 PDT
Created attachment 551043 [details] [diff] [review]
patch
Comment 2 David Baron :dbaron: ⌚️UTC-7 (review requests must explain patch) 2011-08-05 10:28:10 PDT
A good practice that helps avoid problems of this sort is to make each class-specific .h file the first #include in its .cpp file.  In other words, if nsTextEditorState.h were the first #include in nsTextEditorState.cpp, this wouldn't have happened.
Comment 3 arno renevier 2011-08-05 11:58:04 PDT
Created attachment 551105 [details] [diff] [review]
updated patch: make nsTextEditorState.h first include of nsTextEditorState.cpp
Comment 4 :Ehsan Akhgari (busy, don't ask for review please) 2011-08-08 14:28:21 PDT
Landed the patch on mozilla-inbound.  Thanks for writing the patch!
Comment 5 :Ehsan Akhgari (busy, don't ask for review please) 2011-08-09 08:58:38 PDT
http://hg.mozilla.org/mozilla-central/rev/d7db60b35edc

Note You need to log in before you can comment on or make changes to this bug.