[PATCH] dynamic_cast and gcc3
Matthias Kretz
kretz at kde.org
Tue Nov 19 14:45:00 GMT 2002
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Tuesday 19 November 2002 14:37, Simon Hausmann wrote:
> On Mon, Nov 18, 2002 at 05:01:56PM +0100, Matthias Kretz wrote:
> > I'm sorry, I missed a few dynamic_casts in the KView plugins. See #50769.
> > This should fix all problems - dunno why I used dynamic_cast at all...
>
> I hope you are away of the side-effect of this change that
> static_cast only returns a null pointer if the passed object is a
> null pointer, not if the type mismatches, i.e. it is unsafe for type
> inspection.
Yes, you're right I didn't think a lot about the problems this change can
create... Probably a qt_cast would help here.
/me is creating another patch... or not. This can't work since the
KImageViewer::Viewer interface is pure virtual and not a Q_OBJECT. So the
qt_cast will always fail.
I could add the Q_OBJECT macro to the interface and create a lib and all that,
but... not before 3.1, right?
OK, the null pointer checks are not useless yet: The queryList could return
nothing or a null pointer could (somehow) be passed to the ctor (which would
make it fail in the queryList case, though). I do think, that it's more
important to get it working for gcc3 users than to avoid a possible(?) crash
in the case that a wrong parent is passed to the plugin ctor.
- --
C'ya
Matthias
________________________________________________________
Matthias Kretz (Germany)
http://Vir.homeip.net/
MatthiasKretz at gmx.net, kretz at kde.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)
iD8DBQE92k5wyg4WnCj6OIoRAkatAJ4q8fOQfiQ3VG9Wt/PvIuqedeWuPACgiek8
bzjSWYvLJ2ZkINIlwy+jJY4=
=T1e/
-----END PGP SIGNATURE-----
More information about the kde-core-devel
mailing list