Update Slide::getName to return a const reference.
The Viewer slide list stores the values from repeated calls to Slide::getName().c_str() in a large list for filtering purposes. However, the temporary SkString was being destroyed before the list was complete. This luckily happened to work because SkString's refcounting behavior kept the internal buffer alive past the lifetime of the temporary SkString object, but it's not intended to work. Returning a const-ref to the internal SkString is more efficient, and gives us long-lived SkStrings to work with. Change-Id: I958148ba46332f9ec576ac60d0a9b916284c4761 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/306256 Reviewed-by: Brian Osman <brianosman@google.com> Commit-Queue: Brian Osman <brianosman@google.com> Commit-Queue: John Stiles <johnstiles@google.com> Auto-Submit: John Stiles <johnstiles@google.com>
This commit is contained in:
parent
564d49ec10
commit
afb7870f75
@ -34,7 +34,7 @@ public:
|
||||
virtual bool onGetControls(SkMetaData*) { return false; }
|
||||
virtual void onSetControls(const SkMetaData&) {}
|
||||
|
||||
SkString getName() { return fName; }
|
||||
const SkString& getName() { return fName; }
|
||||
|
||||
|
||||
protected:
|
||||
|
Loading…
Reference in New Issue
Block a user