Index: wp-admin/includes/media.php
===================================================================
--- wp-admin/includes/media.php	(revision 11817)
+++ wp-admin/includes/media.php	(working copy)
@@ -41,7 +41,7 @@
 	}
 
 	if ( intval($_REQUEST['post_id']) )
-		$attachments = intval($wpdb->get_var($wpdb->prepare("SELECT count(*) FROM $wpdb->posts WHERE post_type = 'attachment' AND post_parent = %d", $_REQUEST['post_id'])));
+		$attachments = intval($wpdb->get_var($wpdb->prepare("SELECT count(*) FROM $wpdb->posts WHERE post_type = 'attachment' AND post_status != 'trash' AND post_parent = %d", $_REQUEST['post_id'])));
 
 	if ( empty($attachments) ) {
 		unset($tabs['gallery']);
@@ -1054,7 +1054,7 @@
 		if ( $post && $post->post_type == 'attachment' )
 			$attachments = array($post->ID => $post);
 		else
-			$attachments = get_children( array( 'post_parent' => $post_id, 'post_type' => 'attachment', 'orderby' => 'menu_order ASC, ID', 'order' => 'DESC') );
+			$attachments = get_children( array( 'post_parent' => $post_id, 'post_type' => 'attachment', 'post_status' => 'inherit', 'orderby' => 'menu_order ASC, ID', 'order' => 'DESC') );
 	} else {
 		if ( is_array($GLOBALS['wp_the_query']->posts) )
 			foreach ( $GLOBALS['wp_the_query']->posts as $attachment )
