diff options
| author | Jeffrey Altman <jaltman@secure-endpoints.com> | 2007-06-22 18:58:09 +0000 |
|---|---|---|
| committer | Jeffrey Altman <jaltman@secure-endpoints.com> | 2007-06-22 18:58:09 +0000 |
| commit | b3ce9032f0a19eaab43c3bbccb3bfc63635292ae (patch) | |
| tree | 6b3b5aaabe7cf264e11a1d46312b6d3b56053546 /src/windows/identity/sample | |
| parent | 2edfc72bab12e4f7c745184e7795b60f7b567527 (diff) | |
Don't assume that WM_DESTROY is the last message to be received by a
window. Since the child windows are still alive and kicking by the
time the parent receives WM_DESTROY, it's still possible to receive
other messages after WM_DESTROY.
If we free any window specific data when handling WM_DESTROY, we
should reset the window data field as well, and check if we have a
valid pointer when retrieving the window data field later.
ticket: 5584
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@19627 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/windows/identity/sample')
4 files changed, 14 insertions, 1 deletions
diff --git a/src/windows/identity/sample/templates/credprov/config_id.c b/src/windows/identity/sample/templates/credprov/config_id.c index 850016266..0fd08617b 100644 --- a/src/windows/identity/sample/templates/credprov/config_id.c +++ b/src/windows/identity/sample/templates/credprov/config_id.c @@ -88,6 +88,8 @@ config_id_dlgproc(HWND hwnd, case KHUI_WM_CFG_NOTIFY: d = (config_id_dlg_data *) GetWindowLongPtr(hwnd, DWLP_USER); + if (d == NULL) + break; if (HIWORD(wParam) == WMCFG_APPLY) { /* TODO: apply changes */ @@ -108,6 +110,7 @@ config_id_dlgproc(HWND hwnd, /* TODO: perform any other required uninitialization */ free(d); + SetWindowLongPtr(hwnd, DWLP_USER, 0); } } break; diff --git a/src/windows/identity/sample/templates/credprov/config_ids.c b/src/windows/identity/sample/templates/credprov/config_ids.c index 8d6f0081a..ecc49b20c 100644 --- a/src/windows/identity/sample/templates/credprov/config_ids.c +++ b/src/windows/identity/sample/templates/credprov/config_ids.c @@ -72,6 +72,8 @@ config_ids_dlgproc(HWND hwnd, case KHUI_WM_CFG_NOTIFY: d = (config_ids_dlg_data *) GetWindowLongPtr(hwnd, DWLP_USER); + if (d == NULL) + break; if (HIWORD(wParam) == WMCFG_APPLY) { /* TODO: apply changes */ @@ -88,6 +90,7 @@ config_ids_dlgproc(HWND hwnd, /* TODO: Perform any additional uninitialization */ free (d); + SetWindowLongPtr(hwnd, DWLP_USER, 0); } break; } diff --git a/src/windows/identity/sample/templates/credprov/config_main.c b/src/windows/identity/sample/templates/credprov/config_main.c index 87a2a15fc..cf8061b81 100644 --- a/src/windows/identity/sample/templates/credprov/config_main.c +++ b/src/windows/identity/sample/templates/credprov/config_main.c @@ -71,6 +71,8 @@ config_dlgproc(HWND hwnd, { d = (config_main_dlg_data *) GetWindowLongPtr(hwnd, DWLP_USER); + if (d == NULL) + break; /* WMCFG_APPLY is the only notification we care about */ @@ -88,8 +90,10 @@ config_dlgproc(HWND hwnd, /* TODO: perform any other required uninitialization here */ - if (d) + if (d) { free(d); + SetWindowLongPtr(hwnd, DWLP_USER); + } break; } diff --git a/src/windows/identity/sample/templates/credprov/credacq.c b/src/windows/identity/sample/templates/credprov/credacq.c index cd8db44ee..a65686ea4 100644 --- a/src/windows/identity/sample/templates/credprov/credacq.c +++ b/src/windows/identity/sample/templates/credprov/credacq.c @@ -147,6 +147,8 @@ handle_wm_command(HWND hwnd, WPARAM wParam, LPARAM lParam) { struct nc_dialog_data * d; d = (struct nc_dialog_data *) GetWindowLongPtr(hwnd, DWLP_USER); + if (d == NULL) + return FALSE; /* TODO: handle WM_COMMAND */ return FALSE; @@ -165,6 +167,7 @@ handle_wm_destroy(HWND hwnd, WPARAM wParam, LPARAM lParam) { d->nct = NULL; free(d); + SetWindowLongPtr(hwnd, DWLP_USER, 0); } /* TODO: Perform any additional uninitialization */ |
