sane-project-website/old-archive/1997-11/0007.html

116 wiersze
4.7 KiB
HTML

<!-- received="Sat Nov 1 17:19:30 1997 PST" -->
<!-- sent="Sat, 1 Nov 1997 17:19:29 -0800" -->
<!-- name="David Mosberger-Tang" -->
<!-- email="David.Mosberger@acm.org" -->
<!-- subject="gtk-951025 patches" -->
<!-- id="199711020119.RAA31839@panda.mostang.com" -->
<!-- inreplyto="" -->
<title>sane-devel: gtk-951025 patches</title>
<h1>gtk-951025 patches</h1>
<b>David Mosberger-Tang</b> (<a href="mailto:David.Mosberger@acm.org"><i>David.Mosberger@acm.org</i></a>)<br>
<i>Sat, 1 Nov 1997 17:19:29 -0800</i>
<p>
<ul>
<li> <b>Messages sorted by:</b> <a href="date.html#7">[ date ]</a><a href="index.html#7">[ thread ]</a><a href="subject.html#7">[ subject ]</a><a href="author.html#7">[ author ]</a>
<!-- next="start" -->
<li> <b>Next message:</b> <a href="0008.html">David Mosberger-Tang: "v0.67, finally!"</a>
<li> <b>Previous message:</b> <a href="0006.html">David Mosberger-Tang: "Re: ./configure doesn't think I have X"</a>
<!-- nextthread="start" -->
<li> <b>Next in thread:</b> <a href="0009.html">Oliver.Rauch@Wolfsburg.DE: "Re: gtk-951025 patches"</a>
<li> <b>Reply:</b> <a href="0009.html">Oliver.Rauch@Wolfsburg.DE: "Re: gtk-951025 patches"</a>
<li> <b>Reply:</b> <a href="0046.html">Tom Lee: "Re: gtk-951025 patches"</a>
<!-- reply="end" -->
</ul>
<!-- body="start" -->
Here are some GTK patches by Geoffrey Dairiki. I'm interested to hear<br>
whether these fix the UMAX problems.<br>
<p>
--david<br>
<p>
<pre>
---
Without this patch the following sequence of events can happen, with
dire consequences (segfaults...):
<p>
1) gtk_handle_idle starts running the idle_functions list.
<p>
2) One of the idle functions (call it A) queues a second idle
function (B) for removal (on either remove_idles or remove_idles_by_data)
(via a call to gtk_idle_remove, or gtk_idle_remove_by_data).
<p>
Note that when this is done, the corresponding object for B is
deref'ed. This may have been the last reference to the object,
and so, subsequently, its memory may get freed and then reallocated.
<p>
3) If the idle function which was queued for removal hadn't been
run yet --- this happens if B came after A in on the idle_functions
list --- gtk_handle_idle will eventually call idle function B.
Idle function B will try to do stuff with B's object, causing
problems if B's objects memory has already been reused.
<p>
Cheers,
Geoffrey T. Dairiki &lt;<a href="mailto:dairiki@alumni.caltech.edu">dairiki@alumni.caltech.edu</a>&gt;
<p>
diff -ru gtk+971025/gdk/gdk.c gtk+971025-gtd/gdk/gdk.c
--- gtk+971025/gdk/gdk.c Fri Oct 17 11:44:27 1997
+++ gtk+971025-gtd/gdk/gdk.c Fri Oct 31 13:19:23 1997
@@ -207,7 +207,7 @@
int argc_orig = *argc;
char **argv_orig;
- argv_orig = malloc (argc_orig * sizeof(char*));
+ argv_orig = malloc ((argc_orig + 1) * sizeof(char*));
for (i = 0; i &lt; argc_orig; i++)
argv_orig[i] = g_strdup ((*argv)[i]);
argv_orig[argc_orig] = NULL;
<p>
<p>
diff -ru gtk+971025/gtk/gtkmain.c gtk+971025-gtd/gtk/gtkmain.c
--- gtk+971025/gtk/gtkmain.c Thu Oct 2 23:15:31 1997
+++ gtk+971025-gtd/gtk/gtkmain.c Fri Oct 31 19:45:53 1997
@@ -932,9 +932,24 @@
tmp_list = idle_functions;
while (tmp_list)
{
+ GList *rp = 0;
+
idlef = tmp_list-&gt;data;
- if (gtk_idle_invoke_function (idlef) == FALSE)
+ /* Search the remove_ lists to see if the current idlef has
+ * been added (since we started running the idle_functions
+ * list). If it's been added, skip it. (We'll remove it
+ * from the list later --- see below...
+ */
+ for (rp = remove_idles; rp; rp = rp-&gt;next)
+ if (*(gint*)rp-&gt;data == idlef-&gt;tag)
+ break;
+ if (!rp &amp;&amp; remove_idles_by_data)
+ for (rp = remove_idles_by_data; rp; rp = rp-&gt;next)
+ if (*(gpointer*)tmp_list-&gt;data == idlef-&gt;data)
+ break;
+
+ if (!rp &amp;&amp; gtk_idle_invoke_function (idlef) == FALSE)
{
tmp_list2 = tmp_list;
tmp_list = tmp_list-&gt;next;
<p>
<pre>
--
Source code, list archive, and docs: <a href="http://www.mostang.com/sane/">http://www.mostang.com/sane/</a>
To unsubscribe: echo unsubscribe sane-devel | mail <a href="mailto:majordomo@mostang.com">majordomo@mostang.com</a>
</pre>
<!-- body="end" -->
<p>
<ul>
<!-- next="start" -->
<li> <b>Next message:</b> <a href="0008.html">David Mosberger-Tang: "v0.67, finally!"</a>
<li> <b>Previous message:</b> <a href="0006.html">David Mosberger-Tang: "Re: ./configure doesn't think I have X"</a>
<!-- nextthread="start" -->
<li> <b>Next in thread:</b> <a href="0009.html">Oliver.Rauch@Wolfsburg.DE: "Re: gtk-951025 patches"</a>
<li> <b>Reply:</b> <a href="0009.html">Oliver.Rauch@Wolfsburg.DE: "Re: gtk-951025 patches"</a>
<li> <b>Reply:</b> <a href="0046.html">Tom Lee: "Re: gtk-951025 patches"</a>
<!-- reply="end" -->
</ul>