Merge lp://staging/~gamag/widelands/bug1097420 into lp://staging/widelands
Proposed by
Gabriel Margiani
Status: | Merged | ||||
---|---|---|---|---|---|
Merged at revision: | 6486 | ||||
Proposed branch: | lp://staging/~gamag/widelands/bug1097420 | ||||
Merge into: | lp://staging/widelands | ||||
Diff against target: |
19 lines (+2/-7) 1 file modified
src/ui_basic/tabpanel.cc (+2/-7) |
||||
To merge this branch: | bzr merge lp://staging/~gamag/widelands/bug1097420 | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Mark Scott | Approve | ||
Review via email: mp+142412@code.staging.launchpad.net |
Description of the change
The tabpanel gave a const char* to the set_tooltip, which needs a const std::string& .....
(This is a very small change, but maybe a review is good anyway :)
To post a comment you must log in.
Right fix, wrong reason.
set_tooltip(const std::string&) will take a "const char*" - the compiler implicitly constructs a 'string' from the 'const char*' by using the 'string: :string( const char*)' constructor.
If the Tab's tooltip is the empty string "", then the line 't = str.c_str();' will not be executed, leaving 't' with the value 0.
The implicit string constructor will crash if passed a null pointer, giving us this:
"The exception said: basic_string: :_S_construct null not valid"
(std::string is usually a template instantiation of std::basic_ string< char>)