Changeset 483

Show
Ignore:
Timestamp:
08/07/09 09:38:20 (15 years ago)
Author:
vbarta
Message:

fixed UIException::what returning invalid (by the time it returns) pointer

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • library/bdm/base/user_info.h

    r478 r483  
    4545        const string path; 
    4646 
     47private: 
     48        string what_message; 
     49 
     50public: 
    4751        //! Use this constructor when you can pass the problematical Setting as a parameter 
    4852        UIException ( const string &message, const Setting &element ) 
    4953                        : message ( "UI error: " + message + "." ), path ( "Check path \"" + string ( element.getPath() ) + "\"." ) { 
     54                init_what_message(); 
    5055        } 
    5156 
     
    5358        UIException ( const string &message, const string &path ) 
    5459                        : message ( "UI error: " + message + "." ), path ( "Check path \"" + path + "\"." ) { 
     60                init_what_message(); 
    5561        } 
    5662 
    5763        //! Overriden method for reporting an error message 
    5864        virtual const char* what() const throw() { 
    59                 return ( message + " " + path ).c_str(); 
    60         } 
     65                return what_message.c_str(); 
     66        } 
     67 
    6168        ~UIException() throw() {}; 
     69 
     70private: 
     71        void init_what_message() { 
     72                what_message = message; 
     73                what_message += ' '; 
     74                what_message += path; 
     75        } 
    6276}; 
    6377