Fix crashes in edit mode

qlcplus crashes when:
- selecting a function category in dialog instead of a function
- deleting a running function