Skip to content

Commit

Permalink
[win] Fix crash in DragLeave referencing a nullptr
Browse files Browse the repository at this point in the history
newDragEvent() can receive a nullptr pdwEffect from
DragTargetAdapter::DragLeave() when DROPEFFECT_NONE is passed.
  • Loading branch information
dacap committed Nov 21, 2024
1 parent 370ab27 commit 631bc33
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions os/win/dnd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -355,13 +355,14 @@ ULONG DragTargetAdapter::Release()

DragEvent DragTargetAdapter::newDragEvent(POINTL* pt, DWORD* pdwEffect)
{
if (pt)
if (pt) {
// Get drag position
m_position = m_window->pointFromScreen(gfx::Point(pt->x, pt->y));
}

std::unique_ptr<DragDataProvider> ddProvider = std::make_unique<DragDataProviderWin>(m_data.get());
return DragEvent(m_window,
as_dropoperation(*pdwEffect),
(pdwEffect ? as_dropoperation(*pdwEffect): os::DropOperation::None),
m_position,
ddProvider);
}
Expand Down

0 comments on commit 631bc33

Please sign in to comment.