Drag drop crash

Fix a crash and a memory leak.

Note: let's merge it after wx3.0 change. Otherwise EOL might conflict.