Skip to content

notification: Use interface availability to check for Windows version…#16021

Merged
Kontrabant merged 2 commits into
libsdl-org:mainfrom
Kontrabant:win10_check
Jul 18, 2026
Merged

notification: Use interface availability to check for Windows version…#16021
Kontrabant merged 2 commits into
libsdl-org:mainfrom
Kontrabant:win10_check

Conversation

@Kontrabant

Copy link
Copy Markdown
Contributor

… suitability

  • I confirm that I am the author of this code and release it to the SDL project under the Zlib license. This contribution does not contain code from other sources, including code generated by a Large Language Model ("AI").

Explicit version checks require application manifests on Win10, or an older version will be reported. Check for the toast notification history interface, which is only available on Win10+, and use that to determine if the Windows version is high enough to support notifications.

@madebr, can you check this on your test system?

Fixes #16017
Closes #16019

… suitability

Explicit version checks require application manifests on Win10, or an older version will be reported. Check for the toast notification history interface, which is only available on Win10+, and use that to determine if the Windows version is high enough to support notifications.
@Kontrabant
Kontrabant requested a review from madebr July 18, 2026 16:35

@madebr madebr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

testnotification.exe now shows notifications on my Windows 10 system.

@madebr

madebr commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

With transient notifications (T button in testnotification), the second notification causes a EXCEPTION_ACCESS_VIOLATION fatal error with the following stack:

<unknown> 0x00007ff8b6a31850
SDL_SYS_ShowNotification(unsigned int) SDL_windowsnotification.c:1063
SDL_ShowNotificationWithProperties_REAL(unsigned int) SDL_notification.c:42
SDL_ShowNotificationWithProperties(unsigned int) SDL_dynapi_procs.h:1333
ShowNotification(bool) testnotification.c:83
SDL_AppEvent(void *, SDL_Event *) testnotification.c:117
SDL_DispatchMainCallbackEvent(SDL_Event *) SDL_main_callbacks.c:50
SDL_DispatchMainCallbackEvents() SDL_main_callbacks.c:66
SDL_IterateMainCallbacks(bool) SDL_main_callbacks.c:126
GenericIterateMainCallbacks() SDL_sysmain_callbacks.c:65
SDL_EnterAppMainCallbacks_REAL(int, char **, SDL_AppResult (*)(void **, int, char **), SDL_AppResult (*)(void *), SDL_AppResult (*)(void *, SDL_Event *), void (*)(void *, SDL_AppResult)) SDL_sysmain_callbacks.c:76
SDL_EnterAppMainCallbacks(int, char **, SDL_AppResult (*)(void **, int, char **), SDL_AppResult (*)(void *), SDL_AppResult (*)(void *, SDL_Event *), void (*)(void *, SDL_AppResult)) SDL_dynapi_procs.h:207
SDL_main(int, char **) SDL_main_impl.h:59
SDL_CallMainFunction(int, char **, int (*)(int, char **)) SDL_main_callbacks.c:164
SDL_RunApp_REAL(int, char **, int (*)(int, char **), void *) SDL_sysmain_runapp.c:41
SDL_RunApp_DEFAULT(int, char **, int (*)(int, char **), void *) SDL_dynapi_procs.h:804
SDL_RunApp(int, char **, int (*)(int, char **), void *) SDL_dynapi_procs.h:804
main(int, char **) SDL_main_impl.h:103

@Kontrabant

Kontrabant commented Jul 18, 2026

Copy link
Copy Markdown
Contributor Author

Oof, some incorrect casting was causing memory to be clobbered when incrementing or decrementing the delegate refcount. Fixed.

The fun of dealing with COM from C code…

Cast from the generic implementation, which has space for the refcount.
@madebr

madebr commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

I cannot get the app to crash anymore, and I tried hard :)

@Kontrabant

Copy link
Copy Markdown
Contributor Author

Then let's merge this.

@Kontrabant
Kontrabant merged commit f52f31e into libsdl-org:main Jul 18, 2026
10 checks passed
@Kontrabant
Kontrabant deleted the win10_check branch July 18, 2026 21:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Notifications do not work out-of-the-box on Windows 8+

2 participants