Skip to content
  • Orgad Shaneh's avatar
    Avoid storing references to rvalue FileName strings · 831701bb
    Orgad Shaneh authored
    Following 73616849
    
    , it is dangerous to store a reference to the rvalue of
    toString(), since it might become dangling.
    
    Example:
    
    FileName foo() { return FileName::fromString(QLatin1String("/some/file")); }
    
    void func()
    {
        const QString &fileName = foo().toString();
        // fileName is now a dangling reference
    }
    
    Change-Id: I5dfad5dc8dd568a0a3c8f9f71ad93292dc26cbbe
    Reviewed-by: default avatarhjk <hjk@theqtcompany.com>
    831701bb