bug 1155829 - remove AccessibleWrap::SetMaiHyperlink r=surkov

This commit is contained in:
Trevor Saunders 2015-04-07 16:17:09 -04:00
parent b2d197b8cf
commit f97767bd6c
2 changed files with 18 additions and 26 deletions

View File

@ -250,14 +250,22 @@ AccessibleWrap::~AccessibleWrap()
void void
AccessibleWrap::ShutdownAtkObject() AccessibleWrap::ShutdownAtkObject()
{ {
if (mAtkObject) { if (!mAtkObject)
if (IS_MAI_OBJECT(mAtkObject)) { return;
MAI_ATK_OBJECT(mAtkObject)->accWrap = 0;
} if (IS_MAI_OBJECT(mAtkObject)) {
SetMaiHyperlink(nullptr); MAI_ATK_OBJECT(mAtkObject)->accWrap = 0;
g_object_unref(mAtkObject); MaiHyperlink* maiHyperlink
mAtkObject = nullptr; = (MaiHyperlink*)g_object_get_qdata(G_OBJECT(mAtkObject),
quark_mai_hyperlink);
if (maiHyperlink) {
delete maiHyperlink;
g_object_set_qdata(G_OBJECT(mAtkObject), quark_mai_hyperlink, nullptr);
} }
}
g_object_unref(mAtkObject);
mAtkObject = nullptr;
} }
void void
@ -281,28 +289,13 @@ AccessibleWrap::GetMaiHyperlink(bool aCreate /* = true */)
quark_mai_hyperlink); quark_mai_hyperlink);
if (!maiHyperlink && aCreate) { if (!maiHyperlink && aCreate) {
maiHyperlink = new MaiHyperlink(this); maiHyperlink = new MaiHyperlink(this);
SetMaiHyperlink(maiHyperlink); g_object_set_qdata(G_OBJECT(mAtkObject), quark_mai_hyperlink,
maiHyperlink);
} }
} }
return maiHyperlink; return maiHyperlink;
} }
void
AccessibleWrap::SetMaiHyperlink(MaiHyperlink* aMaiHyperlink)
{
NS_ASSERTION(quark_mai_hyperlink, "quark_mai_hyperlink not initialized");
NS_ASSERTION(IS_MAI_OBJECT(mAtkObject), "Invalid AtkObject");
if (quark_mai_hyperlink && IS_MAI_OBJECT(mAtkObject)) {
MaiHyperlink* maiHyperlink = GetMaiHyperlink(false);
if (!maiHyperlink && !aMaiHyperlink) {
return; // Never set and we're shutting down
}
delete maiHyperlink;
g_object_set_qdata(G_OBJECT(mAtkObject), quark_mai_hyperlink,
aMaiHyperlink);
}
}
void void
AccessibleWrap::GetNativeInterface(void** aOutAccessible) AccessibleWrap::GetNativeInterface(void** aOutAccessible)
{ {

View File

@ -63,9 +63,8 @@ public:
bool IsValidObject(); bool IsValidObject();
// get/set the MaiHyperlink object for this AccessibleWrap // get the MaiHyperlink object for this AccessibleWrap
MaiHyperlink* GetMaiHyperlink(bool aCreate = true); MaiHyperlink* GetMaiHyperlink(bool aCreate = true);
void SetMaiHyperlink(MaiHyperlink* aMaiHyperlink);
static const char * ReturnString(nsAString &aString) { static const char * ReturnString(nsAString &aString) {
static nsCString returnedString; static nsCString returnedString;