fix a gdi leak bug.
Merge pull request #1615 from zhangzl2013/bug-gdi-leak

fix a gdi leak bug.