Re: [gtk-list] Re: g_thread_init causes hangs



On Fri, 15 Oct 1999, Sebastian Wilhelmi wrote:

> Hej Ola
> 
> > I tried to make a GTK program with pthreads and when trying
> > to close the program by closing the window it hangs.
> > I removed all thread code and it still hangs because
> > of the g_thread_init call.
> > See code below. Somehow the gtk_object_set_data_full() row
> > is causing the problem, if I comment it the program works fine.
> 
> Ok, thanks for this detailed bug report. Its fixed in CVS:
> 
> Apply the following patch to your glib sources and recompile/reinstall them or
> wait for the next release.
> This should be save wrt the locked data, but please check: Owen or Tim.

thanks sebastian (though it'd be a good idea to Cc: owen or me for immediate
responses). this may fix the intermediate problem, but you still left the
dataset lock in place for data-replacement destroy-notification, so the
complete diff is actually:

--- gdataset.c-premerge Sun Oct 17 18:14:15 1999
+++ gdataset.c  Sun Oct 17 18:15:00 1999
@@ -110,7 +110,11 @@ g_datalist_clear_i (GData **datalist)
       list = prev->next;

       if (prev->destroy_func)
+        {
+          G_UNLOCK (g_dataset_global);
         prev->destroy_func (prev->data);
+          G_LOCK (g_dataset_global);
+        }

       if (g_data_cache_length < G_DATA_CACHE_MAX)
         {
@@ -233,7 +237,11 @@ g_data_set_internal (GData   **datalist,
                * data without destroy notification
                */
               if (list->destroy_func && !destroy_func)
+                {
+                  G_UNLOCK (g_dataset_global);
                 list->destroy_func (list->data);
+                  G_LOCK (g_dataset_global);
+                }

               if (g_data_cache_length < G_DATA_CACHE_MAX)
                 {
@@ -275,7 +283,9 @@ g_data_set_internal (GData    **datalist,
                   /* we need to have updated all structures prior to
                    * invokation of the destroy function
                    */
+                  G_UNLOCK (g_dataset_global);
                   dfunc (ddata);
+                  G_LOCK (g_dataset_global);
                 }

               return;


(applied to both CVS branches now).


---
ciaoTJ



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]