~compiz-team/compiz/compiz.fix_1015593

« back to all changes in this revision

Viewing changes to src/option.cpp

  • Committer: Daniel van Vugt
  • Date: 2012-06-05 08:44:00 UTC
  • mfrom: (3237.1.2 fix-1005569.3)
  • Revision ID: daniel.van.vugt@canonical.com-20120605084400-v627i0spuiz3mynk
Fix up a few issues thumper pointed out in the fixes for LP: #1005569.

  * Use else instead of unconditional reset (makes the first call faster,
    but all others slower, negligibly)
  * Don't mask locals by reusing the same name
  * Remember to reset arg[7] for XkbStateNotify
  * Check for NULL strings. Don't dereference them, just treat as empty.

Show diffs side-by-side

added added

removed removed

Lines of Context:
443
443
void
444
444
CompOption::setName (const char *name, CompOption::Type type)
445
445
{
446
 
    if (priv->name != name)
 
446
    if (!name && !priv->name.empty ())
 
447
        priv->name.clear ();
 
448
    else if (name && priv->name != name)
447
449
        priv->name = name;
448
450
    priv->type = type;
449
451
}