Project

General

Profile

Bug #9521

Crash on Mac OS X in _lib_backgroundjobs_destroy()

Added by Ronny Kahl almost 7 years ago. Updated over 6 years ago.

Status:
Fixed
Priority:
Medium
Assignee:
-
Category:
-
Target version:
-
Start date:
07/18/2013
Due date:
% Done:

100%

Estimated time:
Affected Version:
git development version
System:
Mac OS X
bitness:
64-bit
hardware architecture:
amd64/x86

Description

dt kept crashing in line
if(GTK_IS_WIDGET(j->widget))
in _lib_backgroundjobs_destroy() with a null pointer exception:

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: 13 at address: 0x0000000000000000
[Switching to process 46190 thread 0x410f]
0x0000000129d0766a in _lib_backgroundjobs_destroy (self=<value temporarily unavailable, due to optimizations>, key=0x11ce37e70) at /Users/ronny/src/darktable/src/libs/backgroundjobs.c:192
192 if(GTK_IS_WIDGET(j->widget))

I tracked the problem down in gdb and found j->widget being modified in call to
gtk_container_remove( GTK_CONTAINER(d->jobbox), j->widget );
in _lib_backgroundjobs_progress(). Looks like the destroyed widget is not being erased completely in OS X so that the next GTK_IS_WIDGET(j->widget) crashes.

The following patch seems to solve the problem - no more crashes and the widget is being destroyed when the job has finished or was cancelled:

diff --git a/src/libs/backgroundjobs.c b/src/libs/backgroundjobs.c
index 3376bbb..46130ee 100644
--- a/src/libs/backgroundjobs.c
+++ b/src/libs/backgroundjobs.c
@ -248,7 +248,10 @ static void _lib_backgroundjobs_progress(dt_lib_module_t *self, const guint *ke
if (progress > 0.999999) {
if (GTK_IS_WIDGET(j->widget))
+ {
gtk_container_remove( GTK_CONTAINER(d->jobbox), j->widget );
+ j->widget=NULL;
+ }

#ifdef HAVE_UNITY
unity_launcher_entry_set_progress( j->darktable_launcher, 1.0 );

I didn't feel going into the code too deeply, so I don't know if it's ok to just set the widget to NULL after the first call to gtk_container_remove(). At least for me it seems to work, but I haven't tested thoroughly.

History

#1 Updated by Ronny Kahl over 6 years ago

  • % Done changed from 0 to 100
  • Status changed from New to Fixed

Fixed with revision 86581501

Also available in: Atom PDF

Go to top