]> granicus.if.org Git - gc/commitdiff
Fix assertion violation about disabled cancel in try_to_collect_inner
authorIvan Maidanski <ivmai@mail.ru>
Wed, 29 Nov 2017 22:10:20 +0000 (01:10 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Fri, 15 Dec 2017 18:00:46 +0000 (21:00 +0300)
(Cherry-pick commit 218bfbfa from 'master' branch.)

* misc.c [!GC_DISABLE_INCREMENTAL && !KEEP_BACK_PTRS]
(GC_enable_incremental): Wrap GC_gcollect_inner and GC_read_dirty calls
into DISABLE/RESTORE_CANCEL.

misc.c

diff --git a/misc.c b/misc.c
index 9cbe75066d2adaebd3e573c7cd4746e19ade3582..ccde006e6386488f63c4e8e201893bdf8eca88c1 100644 (file)
--- a/misc.c
+++ b/misc.c
@@ -1345,6 +1345,9 @@ GC_API void GC_CALL GC_enable_incremental(void)
         }
         if (GC_incremental && !GC_dont_gc) {
                                 /* Can't easily do it if GC_dont_gc.    */
+          IF_CANCEL(int cancel_state;)
+
+          DISABLE_CANCEL(cancel_state);
           if (GC_bytes_allocd > 0) {
             /* There may be unmarked reachable objects. */
             GC_gcollect_inner();
@@ -1353,6 +1356,7 @@ GC_API void GC_CALL GC_enable_incremental(void)
             /* clean since nothing can point to an      */
             /* unmarked object.                         */
           GC_read_dirty();
+          RESTORE_CANCEL(cancel_state);
         }
       }
       UNLOCK();