11-11-2007, 15:22
|
mbsiehs
Joined on 09-27-2007
Posts 32
|
Re: Saving RasterImages to SQL 2005
|
 
 
|
|
|
I ran the Release() test three successful times, but on the fourth time I got the "Attempted to..." exception. I also tried the Access()/Release() combination and I still got the same exception. No new information there.
But as I was testing I thought of a third way that I am handling the high resolution and low resolution images differently. Recall that highResolutionImage is a copy of the original image in all its glory (size, etc.) whereas lowResolutionImage is just one sized down so that information retrieval over the network is minimized whenever possible. The difference is that I obtain highResolutionImage from RasterOpenDialog whereas lowResolutionImage is created from highResolutionImage via RasterImage's copy constructor. Better said, highResolutionImage is meerly a pointer to RasterOpenDialog.OpenFileData[0].Image property with MultiSelect set to false.
From that information, I decided not to use the Image property directly, but rather to create a new RasterImage with it via the RasterImage copy constructor. I have run 20 tests with no exception being thrown (usually I get the exception after 4-8 tries). We have an outstanding QA department and I'll get them started on it Monday if they're available, but I feel comfortable that this gives us more information. Incidentally, this fix is the same as one of my previous band-aids where I was calling RasterCodec.Save() and using the copy constructor as the image to save (duplicating RasterOpenDialog's image). My ResizeCommand band-aid fix effectively did the same thing since resizing is non-destructive. The only flaw with this hypothesis is that the sample applications that save to a file behaved just fine.
If this is a sound theory, the net effect for me is that I have to generate another image, which is less than ideal but far more stable. The cost is one of time since the garbage collector will get rid of RasterOpenDialog's RasterImage.
I am working on a multi-threaded application although I don't yet spin off any threads for any imaging functionality. I'm sure that will come, but nothing yet. I'm also on an old-fashioned (ha) single core.
Thanks again for your help. Matt
|
|
|
|
|
Report
|
|
|
|