Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash when shutting down Windows 8.1 if Desktop was never opened #46

Closed
HellBrick opened this issue Jun 15, 2015 · 5 comments
Closed

Crash when shutting down Windows 8.1 if Desktop was never opened #46

HellBrick opened this issue Jun 15, 2015 · 5 comments
Labels

Comments

@HellBrick
Copy link
Contributor

This happens on a Windows 8.1 laptop that launches Start screen instead of Desktop by default. If Switcheroo is set to launched automatically and Desktop (or any classic Desktop software for that matter) is never opened, Switcheroo crashes with 'The instruction at %address% references memory at 0x00000008' alert when you try to shut down the system. Apparently, something goes wrong when the system attempts to gracefully terminate the app.

I've found this in the event viewer, even though it doesn't look very helpful:

Application: switcheroo.exe Framework Version: v4.0.30319 Description: The process was terminated due to an unhandled exception. Exception Info: System.NullReferenceException Stack: at System.Windows.Window.InternalClose(Boolean, Boolean) at System.Windows.Application.DoShutdown() at System.Windows.Application.ShutdownImpl() at System.Windows.Application.ShutdownCallback(System.Object) at System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32) at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate) at System.Windows.Threading.DispatcherOperation.InvokeImpl() at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean) at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean) at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object) at System.Windows.Threading.DispatcherOperation.Invoke() at System.Windows.Threading.Dispatcher.ProcessQueue() at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef) at MS.Win32.HwndWrapper.WndProc(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef) at MS.Win32.HwndSubclass.DispatcherCallbackOperation(System.Object) at System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32) at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate) at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority, System.TimeSpan, System.Delegate, System.Object, Int32) at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr, Int32, IntPtr, IntPtr) at MS.Win32.UnsafeNativeMethods.DispatchMessage(System.Windows.Interop.MSG ByRef) at MS.Win32.UnsafeNativeMethods.DispatchMessage(System.Windows.Interop.MSG ByRef) at System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame) at System.Windows.Application.RunDispatcher(System.Object) at System.Windows.Application.RunInternal(System.Windows.Window) at Switcheroo.Program.Main()

@kvakulo
Copy link
Owner

kvakulo commented Jun 16, 2015

Thanks for the report @HellBrick!

Actually I just experienced the same bug, but it happened even from Desktop.

It seems like it was caused by:

  1. The latest Windows Update, or
  2. Because of installing .NET 4.5.2

Did you by any chance just install the latest updates or installed .NET 4.5.2?

I did both those things at the same time, so I'm not sure which one is now causing Switcheroo to crash on shutdown. Maybe you have a clue? :)

/Regin

@kvakulo kvakulo added the bug label Jun 16, 2015
@HellBrick
Copy link
Contributor Author

This is really weird, because I have a 100% repro: if I open Desktop just once, Switcheroo doesn't crash; if I never open Desktop, it crashes.

Switcheroo actually have been behaving like this for a while now, probably ever since I had installed it on that laptop (I just kept forgetting to submit the issue), so this is unlikely to be connected to the latest updates.

I do have 4.5.2 installed, but I also have it installed on my main PC, where I have never seen this crash. The main PC boots straight to the Desktop though, which seems to be in line with my repro.

Based on the info we currently have, I've no idea what's going on. I'd try analyzing the crash dump or just looking very carefully at the things that happen when the application shuts down.

kvakulo added a commit that referenced this issue Jun 16, 2015
This should prevent Switcheroo from crashing when shutting down windows
without having had the Switcheroo window opened
@kvakulo
Copy link
Owner

kvakulo commented Jun 16, 2015

Really useful feedback! Based on it I think I've might identified the issue: If Switcheroo is shutdown without having been activated, then an uninitialized value is being disposed. Does this commit fix the issue for you?

/ Regin

@HellBrick
Copy link
Contributor Author

Yep, the fix works - I can't reproduce the issue anymore =)

@kvakulo
Copy link
Owner

kvakulo commented Jun 17, 2015

Hurray! :D

/ Regin

@kvakulo kvakulo closed this as completed Jun 17, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants