Now debugging why the accessible objects aren't being created anymore. Will keep the linked list debugging stuff. Also fixed a small "error" in the call to CreateStdAccessibleObject() (not a compiler warning due to how void * works).

This commit is contained in:
Pietro Gagliardi 2015-02-14 16:46:43 -05:00
parent c6cd57e82c
commit 345b4b4263
1 changed files with 46 additions and 1 deletions

View File

@ -3,6 +3,9 @@
// TODOs: // TODOs:
// - make sure E_POINTER and RPC_E_DISCONNECTED are correct returns for IAccessible // - make sure E_POINTER and RPC_E_DISCONNECTED are correct returns for IAccessible
// uncomment this to debug table linked list management
#define TABLE_DEBUG_LINKEDLIST
typedef struct tableAccWhat tableAccWhat; typedef struct tableAccWhat tableAccWhat;
struct tableAccWhat { struct tableAccWhat {
@ -23,6 +26,28 @@ struct tableAcc {
struct tableAcc *next; struct tableAcc *next;
}; };
#ifdef TABLE_DEBUG_LINKEDLIST
void list(struct table *t)
{
struct tableAcc *ta;
printf("\n");
if (t->firstAcc == NULL) {
printf("\tempty\n");
return;
}
printf("\t-> ");
for (ta = t->firstAcc; ta != NULL; ta = ta->next)
printf("%p ", ta);
printf("\n\t<- ");
for (ta = t->firstAcc; ta->next != NULL; ta = ta->next)
;
for (; ta != NULL; ta = ta->prev)
printf("%p ", ta);
printf("\n");
}
#endif
// called after each allocation // called after each allocation
static struct tableAcc *newTableAcc(struct table *t, LONG role, intptr_t row, intptr_t column); static struct tableAcc *newTableAcc(struct table *t, LONG role, intptr_t row, intptr_t column);
@ -89,6 +114,9 @@ static ULONG STDMETHODCALLTYPE tableAccRelease(IAccessible *this)
if (TA->refcount == 0) { if (TA->refcount == 0) {
struct tableAcc *prev, *next; struct tableAcc *prev, *next;
#ifdef TABLE_DEBUG_LINKEDLIST
if (TA->t != NULL) { printf("before delete:"); list(TA->t); }
#endif
if (TA->t != NULL && TA->t->firstAcc == TA) if (TA->t != NULL && TA->t->firstAcc == TA)
TA->t->firstAcc = TA->next; TA->t->firstAcc = TA->next;
prev = TA->prev; prev = TA->prev;
@ -97,6 +125,9 @@ static ULONG STDMETHODCALLTYPE tableAccRelease(IAccessible *this)
prev->next = next; prev->next = next;
if (next != NULL) if (next != NULL)
next->prev = prev; next->prev = prev;
#ifdef TABLE_DEBUG_LINKEDLIST
if (TA->t != NULL) { printf("after delete:"); list(TA->t); }
#endif
if (TA->std != NULL) if (TA->std != NULL)
IAccessible_Release(TA->std); IAccessible_Release(TA->std);
tableFree(TA, "error freeing Table accessibility object"); tableFree(TA, "error freeing Table accessibility object");
@ -180,10 +211,13 @@ static HRESULT STDMETHODCALLTYPE tableAccget_accChild(IAccessible *this, VARIANT
static HRESULT STDMETHODCALLTYPE tableAccget_accName(IAccessible *this, VARIANT varChild, BSTR *pszName) static HRESULT STDMETHODCALLTYPE tableAccget_accName(IAccessible *this, VARIANT varChild, BSTR *pszName)
{ {
printf("get_accName() t %p std %p\n", TA->t, TA->std);
if (TA->t == NULL || TA->std == NULL) { if (TA->t == NULL || TA->std == NULL) {
printf("returning RPC_E_DISCONNECTED\n");
// TODO set values on error // TODO set values on error
return RPC_E_DISCONNECTED; return RPC_E_DISCONNECTED;
} }
printf("running main function\n");
//TODO //TODO
if (pszName == NULL) if (pszName == NULL)
return E_POINTER; return E_POINTER;
@ -389,10 +423,12 @@ static struct tableAcc *newTableAcc(struct table *t, LONG role, intptr_t row, in
IAccessible *std; IAccessible *std;
ta = (struct tableAcc *) tableAlloc(sizeof (struct tableAcc), "error creating Table accessibility object"); ta = (struct tableAcc *) tableAlloc(sizeof (struct tableAcc), "error creating Table accessibility object");
printf("new ta %p\n", ta);
ta->vtbl = &tableAccVtbl; ta->vtbl = &tableAccVtbl;
ta->refcount = 1; ta->refcount = 1;
ta->t = t; ta->t = t;
hr = CreateStdAccessibleObject(t->hwnd, OBJID_CLIENT, &IID_IAccessible, (void *) (&std)); // TODO adjust last argument
hr = CreateStdAccessibleObject(t->hwnd, OBJID_CLIENT, &IID_IAccessible, (void **) (&std));
if (hr != S_OK) if (hr != S_OK)
// TODO panichresult // TODO panichresult
panic("error creating standard accessible object for Table"); panic("error creating standard accessible object for Table");
@ -401,9 +437,15 @@ static struct tableAcc *newTableAcc(struct table *t, LONG role, intptr_t row, in
ta->what.row = row; ta->what.row = row;
ta->what.column = column; ta->what.column = column;
#ifdef TABLE_DEBUG_LINKEDLIST
printf("before add:"); list(t);
#endif
ta->next = t->firstAcc; ta->next = t->firstAcc;
t->firstAcc->prev = ta; t->firstAcc->prev = ta;
t->firstAcc = ta; t->firstAcc = ta;
#ifdef TABLE_DEBUG_LINKEDLIST
printf("after add:"); list(t);
#endif
return ta; return ta;
} }
@ -435,8 +477,11 @@ HANDLER(accessibilityHandler)
// (As you can probably tell, the biggest problem with MSAA is that its documentation is ambiguous and/or self-contradictory...) // (As you can probably tell, the biggest problem with MSAA is that its documentation is ambiguous and/or self-contradictory...)
if (((DWORD) lParam) != ((DWORD) OBJID_CLIENT)) if (((DWORD) lParam) != ((DWORD) OBJID_CLIENT))
return FALSE; return FALSE;
printf("creating ta\n");
ta = newTableAcc(t, ROLE_SYSTEM_TABLE, -1, -1); ta = newTableAcc(t, ROLE_SYSTEM_TABLE, -1, -1);
printf("ta %p\n", ta);
*lResult = LresultFromObject(&IID_IAccessible, wParam, (LPUNKNOWN) (ta)); *lResult = LresultFromObject(&IID_IAccessible, wParam, (LPUNKNOWN) (ta));
printf("lResult %I32d\n", *lResult);
// TODO check *lResult // TODO check *lResult
return TRUE; return TRUE;
} }