[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gnash-dev] What to do when a dynamic cast fail in librender?

From: Bastiaan Jacques
Subject: Re: [Gnash-dev] What to do when a dynamic cast fail in librender?
Date: Sun, 20 Apr 2014 14:46:11 +0200 (CEST)
User-agent: Alpine 2.00 (DEB 1167 2008-08-23)

So far as I can tell, all CachedBitmap objects are created by the
renderer (in createCachedBitmap()), and because that function always
returns a bitmap_info_cairo, a dynamic_cast does not seem to be
required.  You can just replace it with a static_cast instead of
checking the dynamic_cast.


On Sun, 20 Apr 2014, Petter Reinholdtsen wrote:

diff --git a/librender/cairo/Renderer_cairo.cpp 
index c597dd4..2e95686 100644
--- a/librender/cairo/Renderer_cairo.cpp
+++ b/librender/cairo/Renderer_cairo.cpp
@@ -299,6 +299,9 @@ struct StyleHandler : 

        const bitmap_info_cairo* binfo =
            dynamic_cast<const bitmap_info_cairo*>(bm);
+       if (NULL == binfo) { // CID 1154657, binfo used below
+           throw std::bad_cast();
+       }

        cairo_matrix_t mat;
        init_cairo_matrix(&mat, m);

reply via email to

[Prev in Thread] Current Thread [Next in Thread]