Comment on attachment 726580
Implement a replacement of atk_object_set_name() which mimics the behavior 
without calling atk_object_get_name()

>+static void
>+AtkObjectSetName(AtkObject *aAtkObj, const gchar *name)

so, both of the times this is called we have to check if we actually
want to fire an event first.  So why don't we refactor this stuff like
this

make this function
static void
MaybeFireNameChange(AtkObject* aObj, nsString& aNewName)

then it can incapsilate the stuff about comparing against the old name.

>+    size_t name_len = strlen(name);
>+
>+    if (strlen(aAtkObj->name) >= name_len) {
>+      /* If the new name is shorter, then just use the old memory chunk
>+       * to minimize memory fragmentation. */
>+      memcpy(aAtkObj->name, name, name_len + 1);
>+    } else {
>+      g_free(aAtkObj->name);
>+      aAtkObj->name = g_strdup(name);

I'd be suprised if this isn't a win and possibly a loss.  Especially
since the best you can do is strlen while the allocator actually knows
how big the block is.

otherwise this seems like the correct approach so f=me but I'd like to
see another version before r+ :)

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/948788

Title:
  thunderbird crashed on launch

To manage notifications about this bug go to:
https://bugs.launchpad.net/firefox/+bug/948788/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to