Author: sgranjoux Date: Fri Feb 8 21:35:16 2008 New Revision: 3609 URL: http://svn.gnome.org/viewvc/anjuta?rev=3609&view=rev
Log: * plugins/debug-manager/command.c, plugins/debug-manager/command.h, plugins/debug-manager/queue.c: Fix crashes when trying to stop the debugger while it is busy Modified: trunk/ChangeLog trunk/plugins/debug-manager/command.c trunk/plugins/debug-manager/command.h trunk/plugins/debug-manager/queue.c Modified: trunk/plugins/debug-manager/command.c ============================================================================== --- trunk/plugins/debug-manager/command.c (original) +++ trunk/plugins/debug-manager/command.c Fri Feb 8 21:35:16 2008 @@ -118,7 +118,7 @@ NEED_DEBUGGER_STOPPED | NEED_DEBUGGER_STARTED, DMA_QUIT_COMMAND = QUIT_COMMAND | CANCEL_ALL_COMMAND | STOP_DEBUGGER | - NEED_DEBUGGER_STARTED | NEED_PROGRAM_LOADED | NEED_PROGRAM_STOPPED, + HIGH_PRIORITY | NEED_DEBUGGER_STARTED | NEED_PROGRAM_LOADED | NEED_PROGRAM_STOPPED, DMA_ABORT_COMMAND = ABORT_COMMAND | CANCEL_ALL_COMMAND | STOP_DEBUGGER | ASYNCHRONOUS | NEED_DEBUGGER_STARTED | NEED_PROGRAM_LOADED | NEED_PROGRAM_STOPPED | NEED_PROGRAM_RUNNING, Modified: trunk/plugins/debug-manager/command.h ============================================================================== --- trunk/plugins/debug-manager/command.h (original) +++ trunk/plugins/debug-manager/command.h Fri Feb 8 21:35:16 2008 @@ -52,7 +52,8 @@ NEED_PROGRAM_RUNNING = RUN_PROGRAM << (STATE_TO_NEED - STATE_TO_CHANGE), CANCEL_IF_PROGRAM_RUNNING = 1 << 21, CANCEL_ALL_COMMAND = 1 << 22, - ASYNCHRONOUS = 1 << 23 + ASYNCHRONOUS = 1 << 23, + HIGH_PRIORITY = 1 << 24 } DmaCommandFlag; /* Create a new command structure and append to command queue */ Modified: trunk/plugins/debug-manager/queue.c ============================================================================== --- trunk/plugins/debug-manager/queue.c (original) +++ trunk/plugins/debug-manager/queue.c Fri Feb 8 21:35:16 2008 @@ -470,9 +470,9 @@ { IAnjutaDebuggerState state; - if (self->prepend_command) + if (self->prepend_command || dma_command_has_flag (cmd, HIGH_PRIORITY)) { - /* Prepend command use debugger state or current command state */ + /* Prepend command and high priority command use debugger state or current command state */ if (self->last != NULL) { state = dma_command_is_going_to_state (self->last); @@ -708,8 +708,11 @@ g_return_if_fail (self->last != NULL); self->prepend_command++; - dma_command_callback (self->last, data, err); - self->prepend_command--; + if (self->queue_state != IANJUTA_DEBUGGER_STOPPED) + { + dma_command_callback (self->last, data, err); + } + self->prepend_command--; } gboolean @@ -736,9 +739,29 @@ /* Append command at the beginning */ g_queue_push_head (self->queue, cmd); - dma_debugger_queue_complete (self, self->debugger_state); + /* We must not interrupt command having callback, as the command + * will be removed, the callback when emitted will be redirected to + * the handler of the next command */ + if ((state == IANJUTA_DEBUGGER_STOPPED) || (state == IANJUTA_DEBUGGER_PROGRAM_RUNNING)) + { + dma_debugger_queue_complete (self, self->debugger_state); + } + } + else if ((self->prepend_command > 0) || dma_command_has_flag (cmd, HIGH_PRIORITY)) + { + IAnjutaDebuggerState state; + + state = dma_command_is_going_to_state (cmd); + if (state != IANJUTA_DEBUGGER_BUSY) + { + /* Command is changing debugger state */ + dma_queue_cancel_unexpected (self, state); + } + + /* Prepend command at the beginning */ + g_queue_push_head (self->queue, cmd); } - else if (self->prepend_command == 0) + else { /* Append command at the end (in the queue) */ IAnjutaDebuggerState state; @@ -751,11 +774,6 @@ self->queue_state = state; } } - else - { - /* Prepend command at the beginning */ - g_queue_push_head (self->queue, cmd); - } dma_debugger_queue_execute(self); _______________________________________________ SVN-commits-list mailing list (read only) http://mail.gnome.org/mailman/listinfo/svn-commits-list Want to limit the commits to a few modules? Go to above URL, log in to edit your options and select the modules ('topics') you want. Module maintainer? It is possible to set the reply-to to your development mailing list. Email [EMAIL PROTECTED] if interested.