There are two hooks, widget_text and dynamic_sidebar_params. You can use one of them.
add_filter( 'widget_text', 'wpse219770_filter_widget_text', 1, 3 );
function wpse219770_filter_widget_text( $widget_text, $instance, $widget )
{
$tag = 'bartag';//shortcode tag
if ( 'text-2' == $widget->id && has_shortcode( $instance['text'], $tag ) )
remove_shortcode( $tag );
else
add_shortcode( $tag, 'bartag_func' );
return $widget_text;
}
Or you can use this methode:
add_action( 'dynamic_sidebar_params', 'wpse219770_dynamic_sidebar_params_hook', 1, 1 );
function wpse219770_dynamic_sidebar_params_hook( $content )
{
//print_r( $content ) and use it for conditional
$tag = 'bartag';
if ( shortcode_exists( $tag ) )
remove_shortcode( $tag );
return $content;
}