opnsense-ports/graphics/jasper/files/patch-atexit
Franco Fichtner 8cb1a96ede ports: pull in a snapshot of the FreeBSD ports tree
Taken from:	https://github.com/freebsd/freebsd-ports.git
Commit id:	5070672073b68be364139bc6b3a89100bd17d331
2014-11-09 14:03:21 +01:00

31 lines
1,002 B
Text

When compiling with gcc don't register jas_cleanup with atexit.
Instead, mark it as a destructor using a gcc-only extension.
This will avoid crashes, when an application, which has explicitly
dlclosed() libjasper, exits.
If a similar method exists for other compilers, it should be used
too. Or, maybe, something can be done with __cxa_atexit() here...
-mi
--- src/libjasper/include/jasper/jas_init.h 2007-01-19 16:43:04.000000000 -0500
+++ src/libjasper/include/jasper/jas_init.h 2007-08-05 11:42:41.000000000 -0400
@@ -75,5 +75,9 @@
int jas_init(void);
+#ifdef __GNUC__
+void jas_cleanup(void) __attribute__ ((destructor));
+#else
void jas_cleanup(void);
+#endif
#ifdef __cplusplus
--- src/libjasper/base/jas_init.c 2007-01-19 16:43:05.000000000 -0500
+++ src/libjasper/base/jas_init.c 2007-08-05 11:44:00.000000000 -0400
@@ -152,5 +152,4 @@
as it ensures that the JasPer exit handler is called before the
debug memory allocator exit handler. */
- atexit(jas_cleanup);
return 0;