[Windows] Fix StatusIndicator crash with empty tooltip (and few other similar unsafe ptr() uses).
This commit is contained in:
@ -555,7 +555,7 @@ void DisplayServerWindows::_thread_fd_monitor(void *p_ud) {
|
|||||||
flags |= FOS_FORCESHOWHIDDEN;
|
flags |= FOS_FORCESHOWHIDDEN;
|
||||||
}
|
}
|
||||||
pfd->SetOptions(flags | FOS_FORCEFILESYSTEM);
|
pfd->SetOptions(flags | FOS_FORCEFILESYSTEM);
|
||||||
pfd->SetTitle((LPCWSTR)fd->title.utf16().ptr());
|
pfd->SetTitle((LPCWSTR)fd->title.utf16().get_data());
|
||||||
|
|
||||||
String dir = ProjectSettings::get_singleton()->globalize_path(fd->current_directory);
|
String dir = ProjectSettings::get_singleton()->globalize_path(fd->current_directory);
|
||||||
if (dir == ".") {
|
if (dir == ".") {
|
||||||
@ -582,7 +582,7 @@ void DisplayServerWindows::_thread_fd_monitor(void *p_ud) {
|
|||||||
pfd->SetFolder(shellitem);
|
pfd->SetFolder(shellitem);
|
||||||
}
|
}
|
||||||
|
|
||||||
pfd->SetFileName((LPCWSTR)fd->filename.utf16().ptr());
|
pfd->SetFileName((LPCWSTR)fd->filename.utf16().get_data());
|
||||||
pfd->SetFileTypes(filters.size(), filters.ptr());
|
pfd->SetFileTypes(filters.size(), filters.ptr());
|
||||||
pfd->SetFileTypeIndex(0);
|
pfd->SetFileTypeIndex(0);
|
||||||
|
|
||||||
@ -3825,7 +3825,7 @@ DisplayServer::IndicatorID DisplayServerWindows::create_status_indicator(const R
|
|||||||
ndat.uFlags = NIF_ICON | NIF_TIP | NIF_MESSAGE;
|
ndat.uFlags = NIF_ICON | NIF_TIP | NIF_MESSAGE;
|
||||||
ndat.uCallbackMessage = WM_INDICATOR_CALLBACK_MESSAGE;
|
ndat.uCallbackMessage = WM_INDICATOR_CALLBACK_MESSAGE;
|
||||||
ndat.hIcon = hicon;
|
ndat.hIcon = hicon;
|
||||||
memcpy(ndat.szTip, p_tooltip.utf16().ptr(), MIN(p_tooltip.utf16().length(), 127) * sizeof(WCHAR));
|
memcpy(ndat.szTip, p_tooltip.utf16().get_data(), MIN(p_tooltip.utf16().length(), 127) * sizeof(WCHAR));
|
||||||
ndat.uVersion = NOTIFYICON_VERSION;
|
ndat.uVersion = NOTIFYICON_VERSION;
|
||||||
|
|
||||||
Shell_NotifyIconW(NIM_ADD, &ndat);
|
Shell_NotifyIconW(NIM_ADD, &ndat);
|
||||||
@ -3908,7 +3908,7 @@ void DisplayServerWindows::status_indicator_set_tooltip(IndicatorID p_id, const
|
|||||||
ndat.hWnd = windows[MAIN_WINDOW_ID].hWnd;
|
ndat.hWnd = windows[MAIN_WINDOW_ID].hWnd;
|
||||||
ndat.uID = p_id;
|
ndat.uID = p_id;
|
||||||
ndat.uFlags = NIF_TIP;
|
ndat.uFlags = NIF_TIP;
|
||||||
memcpy(ndat.szTip, p_tooltip.utf16().ptr(), MIN(p_tooltip.utf16().length(), 127) * sizeof(WCHAR));
|
memcpy(ndat.szTip, p_tooltip.utf16().get_data(), MIN(p_tooltip.utf16().length(), 127) * sizeof(WCHAR));
|
||||||
ndat.uVersion = NOTIFYICON_VERSION;
|
ndat.uVersion = NOTIFYICON_VERSION;
|
||||||
|
|
||||||
Shell_NotifyIconW(NIM_MODIFY, &ndat);
|
Shell_NotifyIconW(NIM_MODIFY, &ndat);
|
||||||
|
|||||||
Reference in New Issue
Block a user