From 69ca4f9abb926e6988e8b16db3c1c1556c0a85cd Mon Sep 17 00:00:00 2001 From: D-AIRY <admin@ds-servers.com> Date: Wed, 17 Jun 2020 14:07:38 +0300 Subject: [PATCH] Fixed deadlock in WinAPI on dual-cpu systems --- source/terrax/mainWindow.cpp | 6 +++++- source/terrax/terrax.cpp | 5 +++-- source/terrax/terrax.h | 3 +++ 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/source/terrax/mainWindow.cpp b/source/terrax/mainWindow.cpp index 4dc66368e..2d97ff6f6 100644 --- a/source/terrax/mainWindow.cpp +++ b/source/terrax/mainWindow.cpp @@ -2182,6 +2182,10 @@ LRESULT CALLBACK RenderWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lP DeleteObject(hcRotate); break; + case WM_SETTITLEASYNC: + SetWindowTextA(hWnd, (LPCSTR)lParam); + break; + default: return DefWindowProc(hWnd, message, wParam, lParam); } @@ -2276,7 +2280,7 @@ void XInitViewportLayout(X_VIEWPORT_LAYOUT layout) break; } - SendMessage(g_hWndMain, WM_COMMAND, MAKEWPARAM(ID_VIEW_AUTOSIZEVIEWS, 0), 0); + PostMessage(g_hWndMain, WM_COMMAND, MAKEWPARAM(ID_VIEW_AUTOSIZEVIEWS, 0), 0); g_xConfig.m_xViewportLayout = layout; SetMenuItemInfoA(g_hMenu, uMenuId, FALSE, &mii); diff --git a/source/terrax/terrax.cpp b/source/terrax/terrax.cpp index 8e7cd852b..080104890 100644 --- a/source/terrax/terrax.cpp +++ b/source/terrax/terrax.cpp @@ -1609,7 +1609,7 @@ bool XIsMouseInSelection(X_WINDOW_POS wnd) void XUpdateWindowTitle() { const char *szLevelName = g_sLevelName.c_str(); - char szCaption[256]; + static char szCaption[256]; bool isDirty = g_pUndoManager->isDirty(); if(szLevelName && szLevelName[0]) { @@ -1619,5 +1619,6 @@ void XUpdateWindowTitle() { sprintf(szCaption, "%s%s | %s", MAIN_WINDOW_TITLE, isDirty ? " - *" : "", SKYXENGINE_VERSION4EDITORS); } - SetWindowText(g_hWndMain, szCaption); + PostMessageA(g_hWndMain, WM_SETTITLEASYNC, 0, (LPARAM)szCaption); + // SetWindowText(g_hWndMain, szCaption); } diff --git a/source/terrax/terrax.h b/source/terrax/terrax.h index f334b9129..7d9877817 100644 --- a/source/terrax/terrax.h +++ b/source/terrax/terrax.h @@ -26,6 +26,9 @@ #define AB_BUTTON_HEIGHT 40 #define OBJECT_TREE_HEIGHT 300 + +#define WM_SETTITLEASYNC (WM_USER + 1) + #include "Grid.h" enum X_VIEWPORT_LAYOUT -- GitLab