Opened 8 months ago

Closed 8 months ago

#18725 closed defect (fixed)

Build regression on wxAnimation::GetFrame()

Reported by: ettl.martin Owned by: Vadim Zeitlin <vadim@…>
Priority: normal Milestone:
Component: GUI-all Version: dev-latest
Keywords: build regression Cc:
Blocked By: Blocking:
Patch: yes

Description

After updating to latest git-master 2197f9d10e8841ab97d919ff6fcde5bb9721c6ce, a build regression in wxAnimation::GetFrame appeared.

Example

static void bar(const wxAnimation &a)
{
   const wxImage img = a.GetFrame(0);  
}

Adding this piece of code to the animation-sample from wxWidgets and attempt to compile it gives

$ make -f makefile.unx 
`wx-config --cxx` -c -o anitest_anitest.o -I. `wx-config --cxxflags --unicode=yes --static=no --toolkit=gtk2 --version=3.1`   -MTanitest_anitest.o -MF`echo anitest_anitest.o | sed -e 's,\.o$,.d,'` -MD -MP anitest.cpp
anitest.cpp: In function ‘void bar(const wxAnimation&)’:
anitest.cpp:245:36: error: passing ‘const wxAnimation’ as ‘this’ argument discards qualifiers [-fpermissive]
  245 |    const wxImage img = a.GetFrame(0);
      |                                    ^
In file included from anitest.h:11,
                 from anitest.cpp:39:
/usr/local/include/wx-3.1/wx/animate.h:51:13: note:   in call to ‘wxImage wxAnimation::GetFrame(unsigned int)51 |     wxImage GetFrame(unsigned int frame);
      |             ^~~~~~~~
make: *** [makefile.unx:94: anitest_anitest.o] Error 1

$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/9/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:hsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 9.2.1-9ubuntu2' --with-bugurl=file:///usr/share/doc/gcc-9/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,gm2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-9 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none,hsa --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 9.2.1 20191008 (Ubuntu 9.2.1-9ubuntu2) 

Please find attached a patch that adds this code to the animation sample.

Attachments (1)

anitest.diff download (507 bytes) - added by ettl.martin 8 months ago.
patch

Download all attachments as: .zip

Change History (3)

Changed 8 months ago by ettl.martin

patch

comment:1 Changed 8 months ago by vadz

  • Status changed from new to confirmed

Thanks for noticing this, will fix in a moment.

comment:2 Changed 8 months ago by Vadim Zeitlin <vadim@…>

  • Owner set to Vadim Zeitlin <vadim@…>
  • Resolution set to fixed
  • Status changed from confirmed to closed

In ed077e17c/git-wxWidgets:

Restore wxAnimation::GetFrame() constness

This got lost, almost surely accidentally, in 706c8e8ad6 (Merge branch
'disable-native-animation', 2020-04-07), so just restore it now.

See https://github.com/wxWidgets/wxWidgets/pull/1768

Closes #18725.

Note: See TracTickets for help on using tickets.