From: Diana Esch-M. <des...@la...> - 2003-07-31 22:23:37
|
Oh, the gore of the gtk object system!!! So I'm trying to understand the "destroy" process and signal timing. In my app I remove a layer: self.viewarea.get_named_layer(self.image_name) self.viewarea.remove_layer(image) shortly following in the code I have: self.file_open_by_name(filename) self.image_name=filename But tracing what happens (and more importantly when) I see that the file_open_by_name operation occurs before the remove_layer has gone through the whole destroy and finalize process. Now let me see if I understand. In gv_viewarea_remove layer() the teardown is generated and I see this signal is processed immediately, the gtk_object_unref should then start the whole destroy process - right? But I see the processing for the new file I'm adding to the view coming next. Next, I see each destroy for each band with the accompanying catches of the destroy signal to the gv_manager_rester_destroy_cb(). Finally ending in the gv_raster_finalize() with a ref count of 0 that GDALClose() the file. Whew! So, two questions. Why is the destroy process not occurring first. Or, in other words, is there some signal timing I don't quite understand. When a signal is generated is it not processed immediately? Secondly, the code in gv_manager_raster_destroy_cb: if( GDALDereferenceDataset( ds->dataset ) < 1 ) GDALClose( ds->dataset ); seems a bit odd. I understand that you need to deref the counter because you have 1 for the dataset in general and one for each of the bands. Here is where you are deleting the general one But, the raster destroy process seems to be such that the manager_cb is processed first and thus will never be dereferencing to the point to be able to close! Or, put another way, raster_finalize always does the close! By what path would the close ever be invoked here ... or is it just a precautionary code with possibly odd signal timing/handling? Inquiring minds want to know .............. Thanks, -- Diana Esch-Mosher <des...@la...> Los Alamos National Laboratory |