# HG changeset patch # User bsmith@81767d24-ef19-dc11-ae90-00e081727c95 # Date 1322391661 0 # Node ID 2ccf7eacedf5610400d5643250302459f0b10229 # Parent 117cc38a3799e8fb56f4bf8be48769c912160f9c Safety checks in dw_bitmapbutton_new*() on Windows and OS/2. diff -r 117cc38a3799 -r 2ccf7eacedf5 os2/dw.c --- a/os2/dw.c Sun Nov 27 10:54:08 2011 +0000 +++ b/os2/dw.c Sun Nov 27 11:01:01 2011 +0000 @@ -5714,7 +5714,8 @@ NULL, NULL); - strncpy(blah->bubbletext, text, BUBBLE_HELP_MAX - 1); + if(text) + strncpy(blah->bubbletext, text, BUBBLE_HELP_MAX - 1); blah->oldproc = WinSubclassWindow(tmp, _BtProc); WinSetWindowPtr(tmp, QWP_USER, blah); @@ -5811,7 +5812,8 @@ } } - strncpy(blah->bubbletext, text, BUBBLE_HELP_MAX - 1); + if(text) + strncpy(blah->bubbletext, text, BUBBLE_HELP_MAX - 1); blah->oldproc = WinSubclassWindow(tmp, _BtProc); WinSetWindowPtr(tmp, QWP_USER, blah); @@ -5909,7 +5911,8 @@ } } - strncpy(blah->bubbletext, text, BUBBLE_HELP_MAX - 1); + if(text) + strncpy(blah->bubbletext, text, BUBBLE_HELP_MAX - 1); blah->oldproc = WinSubclassWindow(tmp, _BtProc); WinSetWindowPtr(tmp, QWP_USER, blah); diff -r 117cc38a3799 -r 2ccf7eacedf5 win/dw.c --- a/win/dw.c Sun Nov 27 10:54:08 2011 +0000 +++ b/win/dw.c Sun Nov 27 11:01:01 2011 +0000 @@ -3529,29 +3529,32 @@ void _create_tooltip(HWND handle, char *text) { - /* Create a tooltip. */ - HWND hwndTT = CreateWindowEx(WS_EX_TOPMOST, - TOOLTIPS_CLASS, NULL, - WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP, - CW_USEDEFAULT, CW_USEDEFAULT, - CW_USEDEFAULT, CW_USEDEFAULT, - handle, NULL, DWInstance,NULL); - TOOLINFO ti = { 0 }; - - SetWindowPos(hwndTT, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); - - /* Set up "tool" information. - * In this case, the "tool" is the entire parent window. - */ - ti.cbSize = sizeof(TOOLINFO); - ti.uFlags = TTF_SUBCLASS; - ti.hwnd = handle; - ti.hinst = DWInstance; - ti.lpszText = text; - ti.rect.right = ti.rect.bottom = 500; - - /* Associate the tooltip with the "tool" window. */ - SendMessage(hwndTT, TTM_ADDTOOL, 0, (LPARAM) (LPTOOLINFO) &ti); + if(text) + { + /* Create a tooltip. */ + HWND hwndTT = CreateWindowEx(WS_EX_TOPMOST, + TOOLTIPS_CLASS, NULL, + WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP, + CW_USEDEFAULT, CW_USEDEFAULT, + CW_USEDEFAULT, CW_USEDEFAULT, + handle, NULL, DWInstance,NULL); + TOOLINFO ti = { 0 }; + + SetWindowPos(hwndTT, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); + + /* Set up "tool" information. + * In this case, the "tool" is the entire parent window. + */ + ti.cbSize = sizeof(TOOLINFO); + ti.uFlags = TTF_SUBCLASS; + ti.hwnd = handle; + ti.hinst = DWInstance; + ti.lpszText = text; + ti.rect.right = ti.rect.bottom = 500; + + /* Associate the tooltip with the "tool" window. */ + SendMessage(hwndTT, TTM_ADDTOOL, 0, (LPARAM) (LPTOOLINFO) &ti); + } } #ifndef GDIPLUS