Commit Graph

17 Commits

Author SHA1 Message Date
Michael Natterer
79b3326eaa quartz: Bug 674108 - Hard crash due to wrong NSAutoreleasePool stacking
Apply patch from Kristian Rietveld which addresses two issues
in gdkeventloop-quartz.c:

This patch moves the autorelease pool drain and introduces protection against
the invalidated ufds. Basically, when we suspect ufds has been invalidated by a
recursive main loop instance, we refrain from calling the collect function.
2012-09-14 15:18:33 +02:00
Michael Natterer
0729cdc9a1 quartz: fix a race condition when waking up the CGRunLoop
Wake up the run loop unconditionally (don't check if it is waiting) because
it might go into waiting state right after we checked for it. Fixes GIMP
startup (which has a lot of GIOChannel I/O but zero NSEvents) from several
minutes to a few seconds.
2011-11-11 23:54:23 +01:00
Michael Natterer
6f4a6b4936 quartz: handle recursive CFRunLoops
Fixes e.g. crashs when dropping from finder.

Turn the "getting_events" boolean into a counter to handle poll_func()
being called recursively, and track the loop depth correctly by
changing its counter before bailing out in run_loop_observer_callback().
This way we reallocate our autorelease pool at the right time, and
don't kill memory that is still in use by outer run loops.

Also drain, not release the pool, just for some defensive forward
compatibility.
2011-11-06 23:12:57 +01:00
John Ralls
10352d63af Fix typo in 24a7e798 2011-09-23 15:00:03 -07:00
John Ralls
224a7e798a (Backport acf1345) Fix refresh of static autorelease_pool so that it doesn't happen in gtk-nested loops. 2011-09-23 14:03:59 -07:00
Colin Walters
c8262d39fa Use g_source_set_name for all custom GSources in GTK+
Naming the sources allows easier debugging with e.g. SystemTap
probes.

https://bugzilla.gnome.org/show_bug.cgi?id=620511
2010-06-03 21:32:06 -04:00
Richard Hult
b81b90949b Bug 550942 – [patch] Rework of gdkeventloop-quartz.c
2008-11-12  Richard Hult  <richard@imendio.com>

	Bug 550942 – [patch] Rework of gdkeventloop-quartz.c

	* gdk/gdk.c:
	* gdk/gdkinternals.h: Add eventloop debug facility.
	* gdk/quartz/gdkeventloop-quartz.c: Big rework of the quartz
	mainloop integration, patch from Owen Taylor. See bug #550942 for
	the details.

svn path=/trunk/; revision=21783
2008-11-12 13:30:22 +00:00
Richard Hult
cc127bf0a9 Bug 535573 – Deadlock in gdkeventloop-quartz.c:poll_func()
2008-08-07  Richard Hult  <richard@imendio.com>

	Bug 535573 – Deadlock in gdkeventloop-quartz.c:poll_func()

	* gdk/quartz/gdkeventloop-quartz.c: (gdk_event_prepare),
	(select_thread_func), (poll_func): Patch by Yevgen Muntyan, fixes
	deadlock and missing events.

svn path=/trunk/; revision=21030
2008-08-07 08:18:32 +00:00
Johan Dahlin
d97cdbdf53 Include "config.h" instead of <config.h> Command used: find -name
2008-06-21  Johan Dahlin  <jdahlin@async.com.br>

    * *.[ch]: Include "config.h" instead of <config.h>
    Command used:
    find -name \*.[ch]|xargs perl -p -i -e 's/^#include <config.h>/#include "config.h"/g'
    Rubberstamped by Mitch and Tim


svn path=/trunk/; revision=20669
2008-06-22 14:28:52 +00:00
Richard Hult
8ff76c14cd Only set the fake fd's revents, not the first one. Fixes bug #531056,
2008-05-08  Richard Hult  <richard@imendio.com>

	* gdk/quartz/gdkeventloop-quartz.c (poll_func): Only set the fake
	fd's revents, not the first one. Fixes bug #531056, spotted by
	Yevgen Muntyan.

svn path=/trunk/; revision=20086
2008-05-08 17:23:08 +00:00
Richard Hult
4dbd9d23d7 Use the subtype field for the custom event that is used to wake up the
2008-02-24  Richard Hult  <richard@imendio.com>

	* gdk/quartz/gdkprivate-quartz.h:
	* gdk/quartz/gdkeventloop-quartz.c: (got_fd_activity), (poll_func):
	Use the subtype field for the custom event that is used to wake up
	the mainloop so we can have other custom event types.

	* gdk/quartz/gdkevents-quartz.c:
	(_gdk_quartz_events_trigger_crossing_events):
	* gdk/quartz/gdkwindow-quartz.c: (show_window_internal): Create
	crossing events after showing a window if necessary, to work
	around problems with the tracking rect API.

svn path=/trunk/; revision=19637
2008-02-24 17:45:29 +00:00
Richard Hult
d7f3ab0569 Replace the autorelease pools used for each drawing context and in
2007-12-10  Richard Hult  <richard@imendio.com>

	* gdk/quartz/gdkdrawable-quartz.c:
	(gdk_quartz_drawable_get_context),
	(gdk_quartz_drawable_release_context):
	* gdk/quartz/gdkeventloop-quartz.c: (gdk_event_prepare),
	(gdk_event_check), (gdk_event_dispatch), (poll_func):
	* gdk/quartz/gdkwindow-quartz.h: Replace the autorelease pools
	used for each drawing context and in prepare, dispatch and poll
	with one that exists across each main loop iteration. Fixes leaks
	on leopard and protects against future leaks introduce when the
	underlying system changes again (bug #492977).

svn path=/trunk/; revision=19149
2007-12-10 20:22:08 +00:00
Richard Hult
fd8c2c01a9 Fix a bug where we could end up trying to handle the same event more than
2007-12-10  Richard Hult  <richard@imendio.com>

	* gdk/quartz/gdkprivate-quartz.h: 
	* gdk/quartz/gdkeventloop-quartz.c:
	(_gdk_quartz_event_loop_get_pending),
	(_gdk_quartz_event_loop_check_pending),
	(_gdk_quartz_event_loop_release_event), (gdk_event_prepare),
	(gdk_event_check), (gdk_event_dispatch):
	* gdk/quartz/gdkevents-quartz.c: (gdk_events_pending)
	(_gdk_events_queue): Fix a bug where we could end up trying to
	handle the same event more than once. Based on patch from Paul
	Davis.

svn path=/trunk/; revision=19143
2007-12-10 19:00:23 +00:00
Ronald Bultje
92563b7d22 fix two more potential races that could happen when an application is
2007-04-28  Ronald Bultje  <rbultje@ronald.bitfreak.net>

        * gdk/quartz/gdkeventloop-quartz.c: (select_thread_func),
        (poll_func): fix two more potential races that could happen when
        an application is polling in the mainloop and a separate thread
        tries to wake it up using g_idle_add(). Fixes #425271 comment 5.


svn path=/trunk/; revision=17680
2007-04-28 18:14:19 +00:00
Ronald Bultje
7c0f9e4d9d Protect the polling thread setup and shutdown function by mutexes and read
* gdk/quartz/gdkeventloop-quartz.c: Protect the polling thread
          setup and shutdown function by mutexes and read the wakeup
          pipe unconditionally and unblocking. This should make the main
          loop always be woken up when using g_idle_add() from another
          thread in the Quartz backend (#425271).


svn path=/trunk/; revision=17595
2007-04-11 11:08:22 +00:00
Richard Hult
a862e9f6b9 Import AppKit.h instead of Quartz.h. Don't use userSpaceScaleFactor for
2007-02-18  Richard Hult  <richard@imendio.com>

	* gdk/quartz/GdkQuartzView.h:
	* gdk/quartz/GdkQuartzWindow.h:
	* gdk/quartz/gdkquartz.h: Import AppKit.h instead of Quartz.h.
	* gdk/quartz/gdkscreen-quartz.c: (get_mm_from_pixels): Don't use 
	userSpaceScaleFactor for 10.3. Those changes bring us closer to working
	on panther, patch from Mathias Hasselmann.
	
	* gdk/quartz/gdkeventloop-quartz.c: Add includes to fix build warnings.

svn path=/trunk/; revision=17323
2007-02-18 10:26:49 +00:00
Mikael Hallendal
693c3c2649 Factored out the event loop integration into gdkeventloop-quartz.c.
2006-12-28  Mikael Hallendal  <micke@imendio.com>

	* gdk/quartz/gdkevents-quartz.c: Factored out the event loop
	integration into gdkeventloop-quartz.c.

	* gdk/quartz/Makefile.am: Added gdkeventloop-quartz.c

	* gdk/quartz/gdkeventloop-quartz.c: New file containing the event loop
	integration.
2006-12-28 09:04:48 +00:00