Skip to content

Commit 2c01d74

Browse files
committed
much faster shutdown for large workspaces
1 parent 11834d5 commit 2c01d74

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

src/gtkutil.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,8 +262,11 @@ process_events(void)
262262

263263
/* Block too much recursion. 0 is from the top-level, 1 is from a
264264
* callback, we don't want any more than that.
265+
*
266+
* No need to process in batch mode.
265267
*/
266-
if (g_main_depth() < 2) {
268+
if (!main_option_batch &&
269+
g_main_depth() < 2) {
267270
int n;
268271

269272
for (n = 0; n < max_events &&

src/heap.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848

4949
static iObjectClass *parent_class = NULL;
5050

51-
static GSList *heap_all = NULL;
51+
static int n_heap = 0;
5252

5353
/* Call a function, passing in a "safe" PElement ... ie. the PElement points
5454
* at a fresh element which will be safe from the GC.
@@ -199,7 +199,8 @@ heap_sanity(Heap *heap)
199199
void
200200
heap_check_all_destroyed(void)
201201
{
202-
slist_map(heap_all, (SListMapFn) iobject_dump, NULL);
202+
if (n_heap > 0)
203+
printf("unfreed heap!! n_heap = %d\n", n_heap);
203204
}
204205

205206
/* Free a HeapBlock.
@@ -269,7 +270,7 @@ heap_finalize(GObject *gobject)
269270

270271
VIPS_FREEF(g_hash_table_destroy, heap->mtable);
271272

272-
heap_all = g_slist_remove(heap_all, heap);
273+
n_heap -= 1;
273274

274275
G_OBJECT_CLASS(parent_class)->finalize(gobject);
275276
}
@@ -406,7 +407,7 @@ heap_init(Heap *heap)
406407

407408
heap->flush = FALSE;
408409

409-
heap_all = g_slist_prepend(heap_all, heap);
410+
n_heap += 1;
410411
}
411412

412413
GType

0 commit comments

Comments
 (0)