Changeset View
Changeset View
Standalone View
Standalone View
intern/ghost/intern/GHOST_WindowWin32.cpp
| Context not available. | |||||
| 0); // pointer to window-creation data | 0); // pointer to window-creation data | ||||
| free(title_16); | free(title_16); | ||||
| } | } | ||||
| m_user32 = ::LoadLibrary("user32.dll"); | |||||
| if (m_hWnd) { | if (m_hWnd) { | ||||
| if (m_user32) { | |||||
| // Touch enables screens with pen support by default have gestures enabled which results in a delay between | |||||
| // the pointer down event and the first move when using the stylus. RegisterTouchWindow disables the new gesture | |||||
| // architecture enabling the events to be sent immediately to the application rather than being absorbed by | |||||
| // the gesture API. | |||||
| GHOST_WIN32_RegisterTouchWindow pRegisterTouchWindow = | |||||
| (GHOST_WIN32_RegisterTouchWindow)GetProcAddress(m_user32, "RegisterTouchWindow"); | |||||
| if (pRegisterTouchWindow) { | |||||
| pRegisterTouchWindow(m_hWnd, 0); | |||||
| } | |||||
| } | |||||
| // Register this window as a droptarget. Requires m_hWnd to be valid. | // Register this window as a droptarget. Requires m_hWnd to be valid. | ||||
| // Note that OleInitialize(0) has to be called prior to this. Done in GHOST_SystemWin32. | // Note that OleInitialize(0) has to be called prior to this. Done in GHOST_SystemWin32. | ||||
| m_dropTarget = new GHOST_DropTargetWin32(this, m_system); | m_dropTarget = new GHOST_DropTargetWin32(this, m_system); | ||||
| Context not available. | |||||
| ::DestroyWindow(m_hWnd); | ::DestroyWindow(m_hWnd); | ||||
| m_hWnd = 0; | m_hWnd = 0; | ||||
| } | } | ||||
| if (m_user32) { | |||||
LazyDodo: When you free m_user32 here, won't `getDPIHint` below run into trouble?
| |||||
chris_82AuthorUnsubmitted Done Inline ActionsIt's freeing up the reference to user32.dll in the destructor. We shouldn't be calling anything after the destructor is called so getDPIHint shouldn't run into trouble. Here is the full context: GHOST_WindowWin32::~GHOST_WindowWin32()
{
if (m_Bar) {
m_Bar->SetProgressState(m_hWnd, TBPF_NOPROGRESS);
m_Bar->Release();
}
if (m_wintab) {
GHOST_WIN32_WTClose fpWTClose = (GHOST_WIN32_WTClose) ::GetProcAddress(m_wintab, "WTClose");
if (fpWTClose) {
if (m_tablet)
fpWTClose(m_tablet);
delete m_tabletData;
m_tabletData = NULL;
}
}
if (m_customCursor) {
DestroyCursor(m_customCursor);
m_customCursor = NULL;
}
if (m_hWnd != NULL && m_hDC != NULL && releaseNativeHandles()) {
::ReleaseDC(m_hWnd, m_hDC);
}
if (m_hWnd) {
if (m_dropTarget) {
// Disable DragDrop
RevokeDragDrop(m_hWnd);
// Release our reference of the DropTarget and it will delete itself eventually.
m_dropTarget->Release();
}
::SetWindowLongPtr(m_hWnd, GWLP_USERDATA, NULL);
::DestroyWindow(m_hWnd);
m_hWnd = 0;
}
if (m_user32) {
FreeLibrary(m_user32);
m_user32 = NULL;
}
}chris_82: It's freeing up the reference to user32.dll in the destructor. We shouldn't be calling anything… | |||||
| FreeLibrary(m_user32); | |||||
| m_user32 = NULL; | |||||
| } | |||||
| } | } | ||||
| bool GHOST_WindowWin32::getValid() const | bool GHOST_WindowWin32::getValid() const | ||||
| Context not available. | |||||
| GHOST_TUns16 GHOST_WindowWin32::getDPIHint() | GHOST_TUns16 GHOST_WindowWin32::getDPIHint() | ||||
| { | { | ||||
| if (!m_user32) { | |||||
| m_user32 = ::LoadLibrary("user32.dll"); | |||||
| } | |||||
| if (m_user32) { | if (m_user32) { | ||||
| GHOST_WIN32_GetDpiForWindow fpGetDpiForWindow = (GHOST_WIN32_GetDpiForWindow) ::GetProcAddress(m_user32, "GetDpiForWindow"); | GHOST_WIN32_GetDpiForWindow fpGetDpiForWindow = (GHOST_WIN32_GetDpiForWindow) ::GetProcAddress(m_user32, "GetDpiForWindow"); | ||||
| Context not available. | |||||
When you free m_user32 here, won't getDPIHint below run into trouble?