Commit 28a082f6 authored by Francis Beaudet's avatar Francis Beaudet Committed by Alexandre Julliard

Added sanity checks in the cleanup code.

parent 5bd55175
...@@ -785,7 +785,8 @@ TOOLTIPS_DelToolA (HWND hwnd, WPARAM wParam, LPARAM lParam) ...@@ -785,7 +785,8 @@ TOOLTIPS_DelToolA (HWND hwnd, WPARAM wParam, LPARAM lParam)
/* delete text string */ /* delete text string */
toolPtr = &infoPtr->tools[nTool]; toolPtr = &infoPtr->tools[nTool];
if ((toolPtr->hinst) && (toolPtr->lpszText)) { if ((toolPtr->hinst) && (toolPtr->lpszText)) {
if (toolPtr->lpszText != LPSTR_TEXTCALLBACKW) if ( (toolPtr->lpszText != LPSTR_TEXTCALLBACKW) &&
(HIWORD((INT)toolPtr->lpszText) != 0) )
COMCTL32_Free (toolPtr->lpszText); COMCTL32_Free (toolPtr->lpszText);
} }
...@@ -871,7 +872,8 @@ TOOLTIPS_DelToolW (HWND hwnd, WPARAM wParam, LPARAM lParam) ...@@ -871,7 +872,8 @@ TOOLTIPS_DelToolW (HWND hwnd, WPARAM wParam, LPARAM lParam)
/* delete text string */ /* delete text string */
toolPtr = &infoPtr->tools[nTool]; toolPtr = &infoPtr->tools[nTool];
if ((toolPtr->hinst) && (toolPtr->lpszText)) { if ((toolPtr->hinst) && (toolPtr->lpszText)) {
if (toolPtr->lpszText != LPSTR_TEXTCALLBACKW) if ( (toolPtr->lpszText != LPSTR_TEXTCALLBACKW) &&
(HIWORD((INT)toolPtr->lpszText) != 0) )
COMCTL32_Free (toolPtr->lpszText); COMCTL32_Free (toolPtr->lpszText);
} }
...@@ -1572,7 +1574,8 @@ TOOLTIPS_SetToolInfoA (HWND hwnd, WPARAM wParam, LPARAM lParam) ...@@ -1572,7 +1574,8 @@ TOOLTIPS_SetToolInfoA (HWND hwnd, WPARAM wParam, LPARAM lParam)
if (lpToolInfo->lpszText == LPSTR_TEXTCALLBACKA) if (lpToolInfo->lpszText == LPSTR_TEXTCALLBACKA)
toolPtr->lpszText = LPSTR_TEXTCALLBACKW; toolPtr->lpszText = LPSTR_TEXTCALLBACKW;
else { else {
if (toolPtr->lpszText) { if ( (toolPtr->lpszText) &&
(HIWORD((INT)toolPtr->lpszText) != 0) ) {
COMCTL32_Free (toolPtr->lpszText); COMCTL32_Free (toolPtr->lpszText);
toolPtr->lpszText = NULL; toolPtr->lpszText = NULL;
} }
...@@ -1626,7 +1629,8 @@ TOOLTIPS_SetToolInfoW (HWND hwnd, WPARAM wParam, LPARAM lParam) ...@@ -1626,7 +1629,8 @@ TOOLTIPS_SetToolInfoW (HWND hwnd, WPARAM wParam, LPARAM lParam)
if (lpToolInfo->lpszText == LPSTR_TEXTCALLBACKW) if (lpToolInfo->lpszText == LPSTR_TEXTCALLBACKW)
toolPtr->lpszText = LPSTR_TEXTCALLBACKW; toolPtr->lpszText = LPSTR_TEXTCALLBACKW;
else { else {
if (toolPtr->lpszText) { if ( (toolPtr->lpszText) &&
(HIWORD((INT)toolPtr->lpszText) != 0) ) {
COMCTL32_Free (toolPtr->lpszText); COMCTL32_Free (toolPtr->lpszText);
toolPtr->lpszText = NULL; toolPtr->lpszText = NULL;
} }
...@@ -1740,7 +1744,8 @@ TOOLTIPS_UpdateTipTextA (HWND hwnd, WPARAM wParam, LPARAM lParam) ...@@ -1740,7 +1744,8 @@ TOOLTIPS_UpdateTipTextA (HWND hwnd, WPARAM wParam, LPARAM lParam)
if (lpToolInfo->lpszText == LPSTR_TEXTCALLBACKA) if (lpToolInfo->lpszText == LPSTR_TEXTCALLBACKA)
toolPtr->lpszText = LPSTR_TEXTCALLBACKW; toolPtr->lpszText = LPSTR_TEXTCALLBACKW;
else { else {
if (toolPtr->lpszText) { if ( (toolPtr->lpszText) &&
(HIWORD((INT)toolPtr->lpszText) != 0) ) {
COMCTL32_Free (toolPtr->lpszText); COMCTL32_Free (toolPtr->lpszText);
toolPtr->lpszText = NULL; toolPtr->lpszText = NULL;
} }
...@@ -1793,7 +1798,8 @@ TOOLTIPS_UpdateTipTextW (HWND hwnd, WPARAM wParam, LPARAM lParam) ...@@ -1793,7 +1798,8 @@ TOOLTIPS_UpdateTipTextW (HWND hwnd, WPARAM wParam, LPARAM lParam)
if (lpToolInfo->lpszText == LPSTR_TEXTCALLBACKW) if (lpToolInfo->lpszText == LPSTR_TEXTCALLBACKW)
toolPtr->lpszText = LPSTR_TEXTCALLBACKW; toolPtr->lpszText = LPSTR_TEXTCALLBACKW;
else { else {
if (toolPtr->lpszText) { if ( (toolPtr->lpszText) &&
(HIWORD((INT)toolPtr->lpszText) != 0) ) {
COMCTL32_Free (toolPtr->lpszText); COMCTL32_Free (toolPtr->lpszText);
toolPtr->lpszText = NULL; toolPtr->lpszText = NULL;
} }
...@@ -1887,8 +1893,12 @@ TOOLTIPS_Destroy (HWND hwnd, WPARAM wParam, LPARAM lParam) ...@@ -1887,8 +1893,12 @@ TOOLTIPS_Destroy (HWND hwnd, WPARAM wParam, LPARAM lParam)
for (i = 0; i < infoPtr->uNumTools; i++) { for (i = 0; i < infoPtr->uNumTools; i++) {
toolPtr = &infoPtr->tools[i]; toolPtr = &infoPtr->tools[i];
if ((toolPtr->hinst) && (toolPtr->lpszText)) { if ((toolPtr->hinst) && (toolPtr->lpszText)) {
if (toolPtr->lpszText != LPSTR_TEXTCALLBACKW) if ( (toolPtr->lpszText != LPSTR_TEXTCALLBACKW) &&
(HIWORD((INT)toolPtr->lpszText) != 0) )
{
COMCTL32_Free (toolPtr->lpszText); COMCTL32_Free (toolPtr->lpszText);
toolPtr->lpszText = NULL;
}
} }
/* remove subclassing */ /* remove subclassing */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment