progress: call trace2_region_leave() only after calling _enter()
commit3af029c484fc72f546078966af538db55933e83d
authorDerrick Stolee <dstolee@microsoft.com>
Fri, 15 May 2020 16:09:28 +0000 (15 09:09 -0700)
committerJunio C Hamano <gitster@pobox.com>
Fri, 15 May 2020 16:41:30 +0000 (15 09:41 -0700)
tree1d529ad61afc44e3b578b7a6c13a487867044186
parent98a136474082cdc7228d7e0e45672c5274fab701
progress: call trace2_region_leave() only after calling _enter()

A user of progress API calls start_progress() conditionally and
depends on the display_progress() and stop_progress() functions to
become no-op when start_progress() hasn't been called.

As we added a call to trace2_region_enter() to start_progress(), the
calls to other trace2 API calls from the progress API functions must
make sure that these trace2 calls are skipped when start_progress()
hasn't been called on the progress struct.  Specifically, do not
call trace2_region_leave() from stop_progress() when we haven't
called start_progress(), which would have called the matching
trace2_region_enter().

Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
progress.c