dwm-win32 icon indicating copy to clipboard operation
dwm-win32 copied to clipboard

Implement Exception Handling

Open adham-elaraby opened this issue 1 year ago • 3 comments

This implements Exception Handling: by using try-catch blocks to handle exceptions that might occur during the execution of dwm-win32. This allows us to call unmanage() on all windows before crashing, and thus not losing any programs.

The __try block contains the main program code. If an unhandled exception occurs anywhere in this block, control immediately transfers to the __except block. The cleanupOnException function is then called to unmanage all windows before the program crashes.

adham-elaraby avatar Dec 21 '23 10:12 adham-elaraby

Would be great if we could log the error to the windows log.

prabirshrestha avatar Dec 23 '23 05:12 prabirshrestha

Researching a bit doesn't seem like there is a good way to log errors.

In the meantime can you try this https://github.com/prabirshrestha/dwm-win32/pull/71? I'm wondering if the root cause of crashes is due to managing hanged or debugged windows.

I'm still open to this PR but wanted to make sure the other PR solves the issue first.

prabirshrestha avatar Jan 17 '24 05:01 prabirshrestha

Yes, I've also realized that when I looked online, not sure but will have to dig a bit deeper into the best approach to log the errors.

But that is not very relevant, as the changes in this PR don't seem to catch all the errors as I still experience some crashes that don't go through the except block, so there seems to be something else also causing crashes. For now I will try #71

(On a side note the main culprit for me that causes a crash without going through the try except seems to be Zoom, when entering/leaving breakout rooms and sharing presentations)

adham-elaraby avatar Jan 25 '24 00:01 adham-elaraby