Fix runtime warning

Fix two warnings:
 * gtk_container_remove: verify widget has a parent before removing it
 * assertion `path != NULL' failed: do not update text view if path is null