From 92a4cdd9e7e6196012ab20a5597440ceb795d47b Mon Sep 17 00:00:00 2001 From: Raphael Kubo da Costa Date: Thu, 17 Oct 2013 01:09:03 +0300 Subject: [PATCH] Remove assertion in KDecorationUnstable's constructor. Follow-up to c146941, which stopped exporting KDecorationBridgeUnstable. The way the typeinfo and object comparisons are performed in a dynamic_cast are not entirely defined in any ABI spec (or the C++ standard), and the situation gets trickier when a hidden symbol (KDecorationBridgeUnstable) gets passed between a program such as kwin or kcmshell4 and a dlopen()ed library like kwin3_laptop.so: kwin is unaware of the symbol in kwin3_laptop.so and vice-versa, so stricter implementations of the C++ runtime can choose to make the dynamic_cast call fail and return 0. This was a source of crashes on GCC for a long time [1][2] until its developers chose to make the typeinfo comparison in libstdc++ >= 4.5.x less strict and just perform a string comparison of the type names by default. [1] http://article.gmane.org/gmane.comp.gcc.patches/189813 [2] http://gcc.gnu.org/ml/gcc/2002-05/msg01970.html It does not make things more correct, though, and after c146941 KWin started crashing when built in debug mode and run with libcxxrt, another C++ runtime implementation, since it performed a stricted typeinfo comparison by default. Simply removing the dynamic_cast should be fine: it is in an assertion, so the code is not essential, and the assertion itself is not entirely correct. Additionally, the assertion has already been removed from the master branch in commit 4702bbd. REVIEW: 113296 --- libkdecorations/kdecoration.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/libkdecorations/kdecoration.cpp b/libkdecorations/kdecoration.cpp index 3f692be586..3c8b63e408 100644 --- a/libkdecorations/kdecoration.cpp +++ b/libkdecorations/kdecoration.cpp @@ -434,7 +434,6 @@ bool KDecoration::isAlphaEnabled() const KDecorationUnstable::KDecorationUnstable(KDecorationBridge* bridge, KDecorationFactory* factory) : KDecoration(bridge, factory) { - Q_ASSERT(dynamic_cast< KDecorationBridgeUnstable* >(bridge)); } KDecorationUnstable::~KDecorationUnstable()