summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoroharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2009-07-27 18:56:43 +0000
committeroharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2009-07-27 18:56:43 +0000
commit5a824c934f32b9b5b0aaf885f593470babaf5b92 (patch)
treec0c3ac441248cd11cac5d91d88e89f214d6a0403
parente9b919fbc67a12f8825732f028b33c66e8321e11 (diff)
downloadopenocd+libswd-5a824c934f32b9b5b0aaf885f593470babaf5b92.tar.gz
openocd+libswd-5a824c934f32b9b5b0aaf885f593470babaf5b92.tar.bz2
openocd+libswd-5a824c934f32b9b5b0aaf885f593470babaf5b92.tar.xz
openocd+libswd-5a824c934f32b9b5b0aaf885f593470babaf5b92.zip
Fix NPE in GDB_EVENT_END as logforwarding was not disabled early enough
git-svn-id: svn://svn.berlios.de/openocd/trunk@2570 b42882b7-edfa-0310-969c-e2dbd0fdcd60
-rw-r--r--src/server/gdb_server.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/server/gdb_server.c b/src/server/gdb_server.c
index 9151caa8..48144f26 100644
--- a/src/server/gdb_server.c
+++ b/src/server/gdb_server.c
@@ -816,6 +816,11 @@ int gdb_connection_closed(connection_t *connection)
gdb_service_t *gdb_service = connection->service->priv;
gdb_connection_t *gdb_connection = connection->priv;
+ /* we're done forwarding messages. Tear down callback before
+ * cleaning up connection.
+ */
+ log_remove_callback(gdb_log_callback, connection);
+
gdb_actual_connections--;
LOG_DEBUG("GDB Close, Target: %s, state: %s, gdb_actual_connections=%d",
gdb_service->target->cmd_name,
@@ -843,9 +848,10 @@ int gdb_connection_closed(connection_t *connection)
LOG_ERROR("BUG: connection->priv == NULL");
}
+
target_unregister_event_callback(gdb_target_callback_event_handler, connection);
+
target_call_event_callbacks(gdb_service->target, TARGET_EVENT_GDB_END);
- log_remove_callback(gdb_log_callback, connection);
target_call_event_callbacks(gdb_service->target, TARGET_EVENT_GDB_DETACH);