This is a patch for the bug I mentioned on the mail list earlier. When closing a window, sometimes the deleted window still receives some tablet events. I solved this problem with comparing the window address with all active top level windows. In Krita, usually there are very few of them so this is not a real bottleneck.
TODO: it seems the program only adds the new windows to the m_windowMapper hash table, but never deletes the invalid windows. Depending on the meaning of the keys and addresses, this is a dangerous strategy: maybe later a different window can get the same key and mess everything. It would be ideal if the windowMapper could contain, for example QWeakPointers to the windows but unfortunately the QWindow is just a simple address here.