Fixed a threading issue in uiQueueMain() on GTK+.

This commit is contained in:
Pietro Gagliardi 2016-10-31 13:38:38 -04:00
parent 6779ae91d7
commit 211b11b80f
2 changed files with 8 additions and 3 deletions

View File

@ -7,7 +7,10 @@ This README is being written.<br>
## Announcements
* **<codedate**
* **31 October 2016**
* @krakjoe noticed that I accidentally used thread-unsafe code in uiQueueMain() on Unix. Fixed.
* **24 October 2016**
* `uiWindowSetContentSize()` on Unix no longer needs to call up the GTK+ main loop. As a result, bugs related to strange behavior using that function (and the now-deleted `uiWindowSetPosition()` and `uiWindowCenter()`) should go away. I'll need to go through the bugs to verify as much, though.
* **22 October 2016**

View File

@ -91,7 +91,7 @@ static gboolean doqueued(gpointer data)
struct queued *q = (struct queued *) data;
(*(q->f))(q->data);
uiFree(q);
g_free(q);
return FALSE;
}
@ -99,7 +99,9 @@ void uiQueueMain(void (*f)(void *data), void *data)
{
struct queued *q;
q = uiNew(struct queued);
// we have to use g_new0()/g_free() because uiAlloc() is only safe to call on the main thread
// for some reason it didn't affect me, but it did affect krakjoe
q = g_new0(struct queued, 1);
q->f = f;
q->data = data;
gdk_threads_add_idle(doqueued, q);