Instanciate GtkIMCocoaView at gtk_im_context_cocoa_init().
Add NULL checks.