Skip to content

Commit bd56e81

Browse files
committed
Merge pull request godotengine#101015 from bruvzg/si_fix_empty_tt
[Windows] Fix StatusIndicator crash with empty tooltip (and few other similar unsafe `ptr()` uses).
2 parents 887c155 + 663b90d commit bd56e81

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

platform/windows/display_server_windows.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -556,7 +556,7 @@ void DisplayServerWindows::_thread_fd_monitor(void *p_ud) {
556556
flags |= FOS_FORCESHOWHIDDEN;
557557
}
558558
pfd->SetOptions(flags | FOS_FORCEFILESYSTEM);
559-
pfd->SetTitle((LPCWSTR)fd->title.utf16().ptr());
559+
pfd->SetTitle((LPCWSTR)fd->title.utf16().get_data());
560560

561561
String dir = ProjectSettings::get_singleton()->globalize_path(fd->current_directory);
562562
if (dir == ".") {
@@ -583,7 +583,7 @@ void DisplayServerWindows::_thread_fd_monitor(void *p_ud) {
583583
pfd->SetFolder(shellitem);
584584
}
585585

586-
pfd->SetFileName((LPCWSTR)fd->filename.utf16().ptr());
586+
pfd->SetFileName((LPCWSTR)fd->filename.utf16().get_data());
587587
pfd->SetFileTypes(filters.size(), filters.ptr());
588588
pfd->SetFileTypeIndex(0);
589589

@@ -3808,7 +3808,7 @@ DisplayServer::IndicatorID DisplayServerWindows::create_status_indicator(const R
38083808
ndat.uFlags = NIF_ICON | NIF_TIP | NIF_MESSAGE;
38093809
ndat.uCallbackMessage = WM_INDICATOR_CALLBACK_MESSAGE;
38103810
ndat.hIcon = hicon;
3811-
memcpy(ndat.szTip, p_tooltip.utf16().ptr(), MIN(p_tooltip.utf16().length(), 127) * sizeof(WCHAR));
3811+
memcpy(ndat.szTip, p_tooltip.utf16().get_data(), MIN(p_tooltip.utf16().length(), 127) * sizeof(WCHAR));
38123812
ndat.uVersion = NOTIFYICON_VERSION;
38133813

38143814
Shell_NotifyIconW(NIM_ADD, &ndat);
@@ -3891,7 +3891,7 @@ void DisplayServerWindows::status_indicator_set_tooltip(IndicatorID p_id, const
38913891
ndat.hWnd = windows[MAIN_WINDOW_ID].hWnd;
38923892
ndat.uID = p_id;
38933893
ndat.uFlags = NIF_TIP;
3894-
memcpy(ndat.szTip, p_tooltip.utf16().ptr(), MIN(p_tooltip.utf16().length(), 127) * sizeof(WCHAR));
3894+
memcpy(ndat.szTip, p_tooltip.utf16().get_data(), MIN(p_tooltip.utf16().length(), 127) * sizeof(WCHAR));
38953895
ndat.uVersion = NOTIFYICON_VERSION;
38963896

38973897
Shell_NotifyIconW(NIM_MODIFY, &ndat);

0 commit comments

Comments
 (0)