Skip to content

Commit fd5a1c8

Browse files
committedNov 1, 2018
Fix crash on Windows on idle/usb notifications
Fixes #20312, #20319, #20312, #20307, #20299, #20297, #20280 (maybe others)
1 parent c782f27 commit fd5a1c8

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed
 

‎src/native/win/qgswinnative.cpp

+10-1
Original file line numberDiff line numberDiff line change
@@ -163,9 +163,18 @@ QgsNative::NotificationResult QgsWinNative::showDesktopNotification( const QStri
163163
return result;
164164
}
165165

166-
bool QgsWinNativeEventFilter::nativeEventFilter( const QByteArray &, void *message, long * )
166+
bool QgsWinNativeEventFilter::nativeEventFilter( const QByteArray &eventType, void *message, long * )
167167
{
168+
static const QByteArray sWindowsGenericMSG{ "windows_generic_MSG" };
169+
if ( eventType != sWindowsGenericMSG )
170+
return false;
171+
168172
MSG *pWindowsMessage = static_cast<MSG *>( message );
173+
if ( pWindowsMessage->message != WM_DEVICECHANGE )
174+
{
175+
return false;
176+
}
177+
169178
unsigned int wParam = pWindowsMessage->wParam;
170179
if ( wParam == DBT_DEVICEARRIVAL || wParam == DBT_DEVICEREMOVECOMPLETE )
171180
{

0 commit comments

Comments
 (0)