Fix crash when unplug the mouse with pointer in the window.

We should not only call OnSetCapabilities after we create input
but also call OnSetCapabilities before we destroy them.

BUG=250
Merge pull request #257 from CooderIan/fix_pointer_crash

Fix crash when unplug the mouse with pointer in the window.