Commit c077c059 authored by Jan Djärv's avatar Jan Djärv

Try to fix crashes introduced by 2012-09-10T21:01:45Z!jan.h.d@swipnet.se.

* nsfns.m (Fx_open_connection): Move initialization of ns_*_types
to ns_term_init to avoid memory leak.

* nsterm.m (ns_update_begin): Initialize bp after lcokFocus, use
explicit retain/release.
(ns_term_init): Only allow one display.  Initialize outerpool and
ns_*_types.
parent 71ce58e7
2012-09-16 Jan Djärv <jan.h.d@swipnet.se>
* nsfns.m (Fx_open_connection): Move initialization of ns_*_types
to ns_term_init to avoid memory leak.
* nsterm.m (ns_update_begin): Initialize bp after lcokFocus, use
explicit retain/release.
(ns_term_init): Only allow one display. Initialize outerpool and
ns_*_types.
2012-09-15 Paul Eggert <eggert@cs.ucla.edu>
Port _setjmp fix to POSIXish hosts as well as Microsoft.
......
......@@ -1796,19 +1796,6 @@ and GNUstep implementations ("distributor-specific release
SSDATA (display));
}
/* Register our external input/output types, used for determining
applicable services and also drag/drop eligibility. */
ns_send_types = [[NSArray arrayWithObjects: NSStringPboardType, nil] retain];
ns_return_types = [[NSArray arrayWithObjects: NSStringPboardType, nil]
retain];
ns_drag_types = [[NSArray arrayWithObjects:
NSStringPboardType,
NSTabularTextPboardType,
NSFilenamesPboardType,
NSURLPboardType,
NSColorPboardType,
NSFontPboardType, nil] retain];
return Qnil;
}
......
......@@ -627,7 +627,7 @@ Free a pool and temporary objects it refers to (callable from C)
{
NSView *view = FRAME_NS_VIEW (f);
NSRect r = [view frame];
NSBezierPath *bp = [NSBezierPath bezierPath];
NSBezierPath *bp;
NSTRACE (ns_update_begin);
ns_update_auto_hide_menu_bar ();
......@@ -639,8 +639,9 @@ Free a pool and temporary objects it refers to (callable from C)
is for the minibuffer. But the display engine may draw more because
we have set the frame as garbaged. So reset clip path to the whole
view. */
[bp appendBezierPathWithRect: r];
bp = [[NSBezierPath bezierPathWithRect: r] retain];
[bp setClip];
[bp release];
#ifdef NS_IMPL_GNUSTEP
uRect = NSMakeRect (0, 0, 0, 0);
......@@ -3976,33 +3977,35 @@ static Lisp_Object ns_string_to_lispmod (const char *s)
static int ns_initialized = 0;
Lisp_Object tmp;
if (ns_initialized) return x_display_list;
ns_initialized = 1;
NSTRACE (ns_term_init);
[outerpool release];
outerpool = [[NSAutoreleasePool alloc] init];
/* count object allocs (About, click icon); on OS X use ObjectAlloc tool */
/*GSDebugAllocationActive (YES); */
BLOCK_INPUT;
handling_signal = 0;
if (!ns_initialized)
{
baud_rate = 38400;
Fset_input_interrupt_mode (Qnil);
baud_rate = 38400;
Fset_input_interrupt_mode (Qnil);
if (selfds[0] == -1)
if (selfds[0] == -1)
{
if (pipe (selfds) == -1)
{
if (pipe (selfds) == -1)
{
fprintf (stderr, "Failed to create pipe: %s\n",
emacs_strerror (errno));
emacs_abort ();
}
fcntl (selfds[0], F_SETFL, O_NONBLOCK|fcntl (selfds[0], F_GETFL));
FD_ZERO (&select_readfds);
FD_ZERO (&select_writefds);
pthread_mutex_init (&select_mutex, NULL);
fprintf (stderr, "Failed to create pipe: %s\n",
emacs_strerror (errno));
emacs_abort ();
}
ns_initialized = 1;
fcntl (selfds[0], F_SETFL, O_NONBLOCK|fcntl (selfds[0], F_GETFL));
FD_ZERO (&select_readfds);
FD_ZERO (&select_writefds);
pthread_mutex_init (&select_mutex, NULL);
}
ns_pending_files = [[NSMutableArray alloc] init];
......@@ -4193,6 +4196,20 @@ Needs to be here because ns_initialize_display_info () uses AppKit classes.
}
#endif /* MAC OS X menu setup */
/* Register our external input/output types, used for determining
applicable services and also drag/drop eligibility. */
ns_send_types = [[NSArray arrayWithObjects: NSStringPboardType, nil] retain];
ns_return_types = [[NSArray arrayWithObjects: NSStringPboardType, nil]
retain];
ns_drag_types = [[NSArray arrayWithObjects:
NSStringPboardType,
NSTabularTextPboardType,
NSFilenamesPboardType,
NSURLPboardType,
NSColorPboardType,
NSFontPboardType, nil] retain];
[NSApp run];
ns_do_open_file = YES;
return dpyinfo;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment