fix crash when deallocating the toolbar