restore painter before shortcut exit
print unrestored flag debug