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

Cherry pick this patch from master, so that we can fix bug(https://bugs.tizen.org/jira/browse/TC-341) which block the release of tizen.