fix crash on setting canvas width or height for webgl context