diff --git a/wp-admin/includes/theme.php b/wp-admin/includes/theme.php
index eaef0bc..02c150d 100644
--- a/wp-admin/includes/theme.php
+++ b/wp-admin/includes/theme.php
@@ -407,14 +407,15 @@ function wp_prepare_themes_for_js( $themes = null ) {
 
 	WP_Theme::sort_by_name( $themes );
 	foreach ( $themes as $theme ) {
+		$slug = $theme->get_stylesheet();
+		$encoded_slug = urlencode( $slug );
+
 		$parent = false;
 		if ( $theme->parent() ) {
 			$parent = $theme->parent()->display( 'Name' );
+			$parents[ $slug ] = $theme->parent()->get_stylesheet();
 		}
 
-		$slug = $theme->get_stylesheet();
-		$encoded_slug = urlencode( $slug );
-
 		$prepared_themes[ $slug ] = array(
 			'id'           => $slug,
 			'name'         => $theme->display( 'Name' ),
@@ -443,6 +444,11 @@ function wp_prepare_themes_for_js( $themes = null ) {
 		);
 	}
 
+	// Remove 'delete' action if theme has an active child
+	if ( $parents && array_key_exists( $current_theme, $parents ) ) {
+		unset( $prepared_themes[ $parents[ $current_theme ] ]['actions']['delete'] );
+	}
+
 	/**
 	 * Filter the themes prepared for JavaScript, for themes.php.
 	 *
diff --git a/wp-admin/themes.php b/wp-admin/themes.php
index 9457fe3..66177c8 100644
--- a/wp-admin/themes.php
+++ b/wp-admin/themes.php
@@ -12,22 +12,27 @@ require_once( dirname( __FILE__ ) . '/admin.php' );
 if ( !current_user_can('switch_themes') && !current_user_can('edit_theme_options') )
 	wp_die( __( 'Cheatin&#8217; uh?' ) );
 
-if ( current_user_can( 'switch_themes' ) && isset($_GET['action'] ) ) {
+if ( current_user_can( 'switch_themes' ) && isset( $_GET['action'] ) ) {
 	if ( 'activate' == $_GET['action'] ) {
-		check_admin_referer('switch-theme_' . $_GET['stylesheet']);
+		check_admin_referer( 'switch-theme_' . $_GET['stylesheet'] );
 		$theme = wp_get_theme( $_GET['stylesheet'] );
 		if ( ! $theme->exists() || ! $theme->is_allowed() )
 			wp_die( __( 'Cheatin&#8217; uh?' ) );
 		switch_theme( $theme->get_stylesheet() );
-		wp_redirect( admin_url('themes.php?activated=true') );
+		wp_redirect( admin_url( 'themes.php?activated=true' ) );
 		exit;
 	} elseif ( 'delete' == $_GET['action'] ) {
-		check_admin_referer('delete-theme_' . $_GET['stylesheet']);
+		check_admin_referer( 'delete-theme_' . $_GET['stylesheet'] );
 		$theme = wp_get_theme( $_GET['stylesheet'] );
-		if ( !current_user_can('delete_themes') || ! $theme->exists() )
+		if ( ! current_user_can( 'delete_themes' ) || ! $theme->exists() )
 			wp_die( __( 'Cheatin&#8217; uh?' ) );
-		delete_theme($_GET['stylesheet']);
-		wp_redirect( admin_url('themes.php?deleted=true') );
+		$active = wp_get_theme();
+		if ( $active->get( "Template" ) == $_GET['stylesheet'] ) {
+			wp_redirect( admin_url( 'themes.php?active-child=true' ) );
+		} else {
+			delete_theme( $_GET['stylesheet'] );
+			wp_redirect( admin_url( 'themes.php?deleted=true' ) );
+		}
 		exit;
 	}
 }
@@ -133,6 +138,8 @@ if ( ! validate_current_theme() || isset( $_GET['broken'] ) ) : ?>
 		}
 	elseif ( isset($_GET['deleted']) ) : ?>
 <div id="message3" class="updated"><p><?php _e('Theme deleted.') ?></p></div>
+<?php elseif ( isset( $_GET['active-child'] ) ) : ?>
+	<div id="message4" class="error"><p><?php _e( 'You cannot delete a theme while it has an active child theme.' ); ?></p></div>
 <?php
 endif;
 
