Skip to content

Commit

Permalink
Fix random crashes caused by accidental 32bit pointer casts in EventM…
Browse files Browse the repository at this point in the history
…onitor (thx risu), closes #22
  • Loading branch information
noorus committed Nov 16, 2014
1 parent 54a359e commit c5f6802
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/EventMonitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,11 +161,11 @@ namespace Nil {
{
auto createstruct = (LPCREATESTRUCTW)lParam;
auto me = (EventMonitor*)createstruct->lpCreateParams;
SetWindowLongPtrW( window, GWLP_USERDATA, PtrToUlong( me ) );
SetWindowLongPtrW( window, GWLP_USERDATA, (DWORD_PTR)me );
return 1;
}

auto ptr = static_cast<LONG_PTR>( GetWindowLongPtrW( window, GWLP_USERDATA ) );
auto ptr = static_cast<DWORD_PTR>( GetWindowLongPtrW( window, GWLP_USERDATA ) );
auto me = reinterpret_cast<EventMonitor*>( ptr );

if ( !me )
Expand Down

0 comments on commit c5f6802

Please sign in to comment.