app: g_return_if_fail (shell_selection) on the public API in gimpdisplayshell-selection.c, move free null check to gimpdisplayshell's dispose()

This commit is contained in:
Mikael Magnusson 2013-06-16 20:14:35 +02:00
parent 6cb9ef6e38
commit cfd360aa03
3 changed files with 25 additions and 21 deletions

View File

@ -116,34 +116,33 @@ void
gimp_display_shell_selection_free (GimpDisplayShell *shell)
{
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
g_return_if_fail (shell->selection != NULL);
if (shell->selection)
{
Selection *selection = shell->selection;
Selection *selection = shell->selection;
selection_stop (selection);
selection_stop (selection);
g_signal_handlers_disconnect_by_func (shell,
selection_window_state_event,
selection);
g_signal_handlers_disconnect_by_func (shell,
selection_visibility_notify_event,
selection);
g_signal_handlers_disconnect_by_func (shell,
selection_window_state_event,
selection);
g_signal_handlers_disconnect_by_func (shell,
selection_visibility_notify_event,
selection);
selection_free_segs (selection);
selection_free_segs (selection);
g_slice_free (Selection, selection);
g_slice_free (Selection, selection);
shell->selection = NULL;
}
shell->selection = NULL;
}
void
gimp_display_shell_selection_undraw (GimpDisplayShell *shell)
{
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
g_return_if_fail (shell->selection != NULL);
if (shell->selection && gimp_display_get_image (shell->display))
if (gimp_display_get_image (shell->display))
{
selection_undraw (shell->selection);
}
@ -158,8 +157,9 @@ void
gimp_display_shell_selection_restart (GimpDisplayShell *shell)
{
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
g_return_if_fail (shell->selection != NULL);
if (shell->selection && gimp_display_get_image (shell->display))
if (gimp_display_get_image (shell->display))
{
selection_start (shell->selection);
}
@ -169,8 +169,9 @@ void
gimp_display_shell_selection_pause (GimpDisplayShell *shell)
{
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
g_return_if_fail (shell->selection != NULL);
if (shell->selection && gimp_display_get_image (shell->display))
if (gimp_display_get_image (shell->display))
{
if (shell->selection->paused == 0)
selection_stop (shell->selection);
@ -183,8 +184,9 @@ void
gimp_display_shell_selection_resume (GimpDisplayShell *shell)
{
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
g_return_if_fail (shell->selection != NULL);
if (shell->selection && gimp_display_get_image (shell->display))
if (gimp_display_get_image (shell->display))
{
shell->selection->paused--;
@ -198,8 +200,9 @@ gimp_display_shell_selection_set_show (GimpDisplayShell *shell,
gboolean show)
{
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
g_return_if_fail (shell->selection != NULL);
if (shell->selection && gimp_display_get_image (shell->display))
if (gimp_display_get_image (shell->display))
{
Selection *selection = shell->selection;

View File

@ -773,7 +773,8 @@ gimp_display_shell_dispose (GObject *object)
shell->popup_manager = NULL;
gimp_display_shell_selection_free (shell);
if (shell->selection)
gimp_display_shell_selection_free (shell);
if (shell->filter_stack)
gimp_display_shell_filter_set (shell, NULL);

View File

@ -1312,7 +1312,7 @@ gimp_dockbook_recreate_tab_widgets (GimpDockbook *dockbook,
GtkWidget *tab_widget;
if (only_auto &&
gimp_dockable_get_tab_style (dockable) != GIMP_TAB_STYLE_AUTOMATIC)
! (gimp_dockable_get_tab_style (dockable) == GIMP_TAB_STYLE_AUTOMATIC))
continue;
tab_widget = gimp_dockbook_create_tab_widget (dockbook, dockable);