Mercurial > octave
changeset 32731:4c90bb1003ba stable
avoid GCC warning about dangling reference to temporary
* QtHandlesUtils.h (Utils::properties): Declare argument as reference
to avoid copy. Provide separate const overload.
* EditControl.cc (EditControl::create): Declare reference to
uicontrol::properties object as const.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 11 Jan 2024 14:21:39 -0500 |
parents | d2203c8960a2 |
children | b38f124af0d6 1c40194c7b1f |
files | libgui/graphics/EditControl.cc libgui/graphics/QtHandlesUtils.h |
diffstat | 2 files changed, 7 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/libgui/graphics/EditControl.cc Thu Jan 11 13:51:44 2024 -0500 +++ b/libgui/graphics/EditControl.cc Thu Jan 11 14:21:39 2024 -0500 @@ -47,7 +47,7 @@ if (container) { - uicontrol::properties& up = Utils::properties<uicontrol> (go); + const uicontrol::properties& up = Utils::properties<uicontrol> (go); if ((up.get_max () - up.get_min ()) > 1) return new EditControl (interp, go,
--- a/libgui/graphics/QtHandlesUtils.h Thu Jan 11 13:51:44 2024 -0500 +++ b/libgui/graphics/QtHandlesUtils.h Thu Jan 11 14:21:39 2024 -0500 @@ -69,9 +69,14 @@ template <typename T> inline typename T::properties& - properties (graphics_object obj) + properties (graphics_object& obj) { return dynamic_cast<typename T::properties&> (obj.get_properties ()); } + template <typename T> + inline const typename T::properties& + properties (const graphics_object& obj) + { return dynamic_cast<const typename T::properties&> (obj.get_properties ()); } + QImage makeImageFromCData (const octave_value& v, int width = -1, int height = -1);