~sil2100/compiz/0.9.8_fix_ftbfs_arm

Viewing all changes in revision 3408.

  • Committer: Daniel van Vugt
  • Date: 2012-10-16 05:53:52 UTC
  • Revision ID: daniel.van.vugt@canonical.com-20121016055352-igpe3oaj1m24y61p
Avoid duplicate template instantiations of PluginClassHandler<>, at least
for those plugins that get re-used by others.

Duplicate template instances are normally harmless and only cause binary
bloat. However if you have static members in an template like:
    PluginClassHandler<CompositeScreen,CompScreen,N>::mIndex
then that static variable also gets multiple separate instances. And the
version that a plugin uses depends entirely on the shared library load order
and load flags.

With clang, the OpenGL plugin was getting its own copy of the Composite
templates resulting in crash LP: #1065815. This is because clang compiles
mIndex to be a weak linkage symbol, so the dynamic loader at runtime chooses
which version to use. The crash does not happen with GCC because it compiles
mIndex to be a "unique" symbol (GNU extension), automatically avoiding
such duplicate problems.

More generally this possibly explains some crashes we see in and
around PluginClassHandler when plugins are toggled in CCSM. Although there
may be other templates that need similar fixes yet to resolve those.

expand all expand all

Show diffs side-by-side

added added

removed removed

Lines of Context: