Rawtherapee: build fails when using libcairo 1.15

Created on 28 Nov 2016  路  6Comments  路  Source: Beep6581/RawTherapee

Reported by @mbajor on irc

[ 241s] /home/abuild/rpmbuild/BUILD/rawtherapee-4.2.1197/rtengine/../rtgui/guiutils.h:440:16: error: cannot convert 'Cairo::RefPtr' to 'bool' in return
[ 241s] return surface;

using libcairo 1.14 it builds

patch provided bug

Most helpful comment

@mbajor Can you test this patch please?

diff --git a/rtgui/guiutils.h b/rtgui/guiutils.h
index 38f5297..b8e058e 100644
--- a/rtgui/guiutils.h
+++ b/rtgui/guiutils.h
@@ -437,7 +437,7 @@ public:
     // you have to check if the surface is created thanks to surfaceCreated before starting to draw on it
     bool surfaceCreated()
     {
-        return surface;
+        return static_cast<bool>(surface);
     }
     Cairo::RefPtr<Cairo::ImageSurface> getSurface()
     {

All 6 comments

@mbajor Can you test this patch please?

diff --git a/rtgui/guiutils.h b/rtgui/guiutils.h
index 38f5297..b8e058e 100644
--- a/rtgui/guiutils.h
+++ b/rtgui/guiutils.h
@@ -437,7 +437,7 @@ public:
     // you have to check if the surface is created thanks to surfaceCreated before starting to draw on it
     bool surfaceCreated()
     {
-        return surface;
+        return static_cast<bool>(surface);
     }
     Cairo::RefPtr<Cairo::ImageSurface> getSurface()
     {

@heckflosse Fix confirmed. Thanks ! :)

@Beep6581 @Floessie @Hombre57
Any objections to commit this in master branch?

No objection on committing.

Just for my personal information: isn't bool(surface) the same than static_cast<bool>(surface); ?

@heckflosse Absolutely no objections. I would have solved it exactly the same way.

@Hombre57

Just for my personal information: isn't bool(surface) the same than static_cast(surface); ?

No. A C-style cast is equivalent to reinterpret_cast<>, which has no restrictions at all. For a static_cast<> the types have to be convertible. But you are right: In this place a c'tor-like C-style cast would have also done, although a C++-style cast should be prefered as it's more meaningful.

Best
Fl枚ssie

Was this page helpful?
0 / 5 - 0 ratings

Related issues

agriggio picture agriggio  路  4Comments

heckflosse picture heckflosse  路  3Comments

heckflosse picture heckflosse  路  4Comments

Beep6581 picture Beep6581  路  5Comments

Floessie picture Floessie  路  5Comments