len = strlen (str);
if ((min (PTRDIFF_MAX, SIZE_MAX) - len - 1) / 4 < nr_bad)
memory_full (SIZE_MAX);
- up = utf8_str = xmalloc (len + nr_bad * 4 + 1);
+ up = utf8_str = xmalloc_atomic (len + nr_bad * 4 + 1);
p = (unsigned char *)str;
while (! (cp = g_locale_to_utf8 ((char *)p, -1, &bytes_read,
static int
xg_dialog_run (struct frame *f, GtkWidget *w)
{
- ptrdiff_t count = SPECPDL_INDEX ();
+ dynwind_begin ();
struct xg_dialog_data dd;
xg_set_screen (w, f);
g_main_loop_run (dd.loop);
dd.w = 0;
- unbind_to (count, Qnil);
+ dynwind_end ();
return dd.response;
}
static char *
xg_get_file_name_from_chooser (GtkWidget *w)
{
- return gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (w));
+ char *s1, *s2;
+ s1 = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (w));
+ if (! s1)
+ return NULL;
+ s2 = xstrdup (s1);
+ g_free (s1);
+ return s2;
}
/* Callback called when the "Show hidden files" toggle is pressed.
{
if (! cl_data)
{
- cl_data = xmalloc (sizeof *cl_data);
+ cl_data = xmalloc_uncollectable (sizeof *cl_data);
cl_data->f = f;
cl_data->menu_bar_vector = f->menu_bar_vector;
cl_data->menu_bar_items_used = f->menu_bar_items_used;
}
}
-/* Function that marks all lisp data during GC. */
-
-void
-xg_mark_data (void)
-{
- xg_list_node *iter;
- Lisp_Object rest, frame;
-
- for (iter = xg_menu_cb_list.next; iter; iter = iter->next)
- mark_object (((xg_menu_cb_data *) iter)->menu_bar_vector);
-
- for (iter = xg_menu_item_cb_list.next; iter; iter = iter->next)
- {
- xg_menu_item_cb_data *cb_data = (xg_menu_item_cb_data *) iter;
-
- if (! NILP (cb_data->help))
- mark_object (cb_data->help);
- }
-
- FOR_EACH_FRAME (rest, frame)
- {
- struct frame *f = XFRAME (frame);
-
- if (FRAME_X_P (f) && FRAME_GTK_OUTER_WIDGET (f))
- {
- struct xg_frame_tb_info *tbinfo
- = g_object_get_data (G_OBJECT (FRAME_GTK_OUTER_WIDGET (f)),
- TB_INFO_KEY);
- if (tbinfo)
- {
- mark_object (tbinfo->last_tool_bar);
- mark_object (tbinfo->style);
- }
- }
- }
-}
-
-
/* Callback called when a menu item is destroyed. Used to free data.
W is the widget that is being destroyed (not used).
CLIENT_DATA points to the xg_menu_item_cb_data associated with the W. */
{
w = gtk_image_new_from_stock (stock_name, icon_size);
g_object_set_data_full (G_OBJECT (w), XG_TOOL_BAR_STOCK_NAME,
- (gpointer) xstrdup (stock_name),
- (GDestroyNotify) xfree);
+ (gpointer) g_strdup (stock_name),
+ (GDestroyNotify) g_free);
}
else if (icon_name)
{
w = gtk_image_new_from_icon_name (icon_name, icon_size);
g_object_set_data_full (G_OBJECT (w), XG_TOOL_BAR_ICON_NAME,
- (gpointer) xstrdup (icon_name),
- (GDestroyNotify) xfree);
+ (gpointer) g_strdup (icon_name),
+ (GDestroyNotify) g_free);
}
else
{