From c1fbb70c6d791aa470de5cd6e0cf9b056da3458e Mon Sep 17 00:00:00 2001 From: rdb Date: Sun, 21 Mar 2021 16:55:19 +0100 Subject: [PATCH] display: Temporary fix for base.win.properties.size et al Previously, calling that without storing a temporary object would cause the WindowProperties to go out of scope and the return value to point to random memory. --- panda/src/display/windowProperties.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/panda/src/display/windowProperties.h b/panda/src/display/windowProperties.h index 0d9b162c6c..82dcbb5358 100644 --- a/panda/src/display/windowProperties.h +++ b/panda/src/display/windowProperties.h @@ -68,7 +68,11 @@ PUBLISHED: INLINE void set_origin(const LPoint2i &origin); INLINE void set_origin(int x_origin, int y_origin); +#ifdef CPPPARSER + INLINE LPoint2i get_origin() const; +#else INLINE const LPoint2i &get_origin() const; +#endif INLINE int get_x_origin() const; INLINE int get_y_origin() const; INLINE bool has_origin() const; @@ -77,7 +81,11 @@ PUBLISHED: INLINE void set_size(const LVector2i &size); INLINE void set_size(int x_size, int y_size); +#ifdef CPPPARSER + INLINE LVector2i get_size() const; +#else INLINE const LVector2i &get_size() const; +#endif INLINE int get_x_size() const; INLINE int get_y_size() const; INLINE bool has_size() const; @@ -92,7 +100,11 @@ PUBLISHED: set_mouse_mode, clear_mouse_mode); INLINE void set_title(const std::string &title); +#ifdef CPPPARSER + INLINE std::string get_title() const; +#else INLINE const std::string &get_title() const; +#endif INLINE bool has_title() const; INLINE void clear_title(); MAKE_PROPERTY2(title, has_title, get_title, set_title, clear_title); @@ -151,14 +163,22 @@ PUBLISHED: set_cursor_hidden, clear_cursor_hidden); INLINE void set_icon_filename(const Filename &icon_filename); +#ifdef CPPPARSER + INLINE Filename get_icon_filename() const; +#else INLINE const Filename &get_icon_filename() const; +#endif INLINE bool has_icon_filename() const; INLINE void clear_icon_filename(); MAKE_PROPERTY2(icon_filename, has_icon_filename, get_icon_filename, set_icon_filename, clear_icon_filename); INLINE void set_cursor_filename(const Filename &cursor_filename); +#ifdef CPPPARSER + INLINE Filename get_cursor_filename() const; +#else INLINE const Filename &get_cursor_filename() const; +#endif INLINE bool has_cursor_filename() const; INLINE void clear_cursor_filename(); MAKE_PROPERTY2(cursor_filename, has_cursor_filename, get_cursor_filename,