From: buliabyak Date: Sun, 18 Mar 2007 02:01:19 +0000 (+0000) Subject: fix crash when you quickly click in two areas and then press a key to go to another... X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=7d2ea7490dfb2b584fcfff6df9188918120e8d43;p=inkscape.git fix crash when you quickly click in two areas and then press a key to go to another tool before filling is finished --- diff --git a/src/flood-context.cpp b/src/flood-context.cpp index 367e56a3d..648d00bcb 100644 --- a/src/flood-context.cpp +++ b/src/flood-context.cpp @@ -779,15 +779,20 @@ static gint sp_flood_context_root_handler(SPEventContext *event_context, GdkEven if (!(event->button.state & GDK_CONTROL_MASK)) { // set "busy" cursor desktop->setWaitingCursor(); + + if (SP_IS_EVENT_CONTEXT(event_context)) { + // Since setWaitingCursor runs main loop iterations, we may have already left this tool! + // So check if the tool is valid before doing anything + + sp_flood_do_flood_fill(event_context, event); - sp_flood_do_flood_fill(event_context, event); - - // restore cursor when done; note that it may already be different if e.g. user - // switched to another tool during interruptible tracing or drawing, in which case do nothing - if (desktop->waiting_cursor) - sp_event_context_update_cursor(event_context); + // restore cursor when done; note that it may already be different if e.g. user + // switched to another tool during interruptible tracing or drawing, in which case do nothing + if (desktop->waiting_cursor) + sp_event_context_update_cursor(event_context); - ret = TRUE; + ret = TRUE; + } } } break;