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
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.
Revision history for this message
Mark Scott (mxsscott) wrote :

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>)

review: Approve
Revision history for this message
SirVer (sirver) wrote :

stuff like this happen easy when you convert const char* to string - which i recently did for tooltips.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches

to status/vote changes: