T O P I C R E V I E W |
mouser |
Posted - Mar 27 2013 : 08:52:47 I'm getting what seem to be random access violations and exceptions () when making some innocuous looking calls to things like: TIEAcquireSource source = ImageEnView->IO->SelectedAcquireSource; or TIEAcquireSource source = ImageEnView->IO->AcquireParams->SelectedSource;
in addition to Access Violations most often I see the exception thrown "Invalid Variant Type"
It doesn't always occur but it happens very frequently -- i can easily trigger it after one or two tries.. Easiest way seems to be to bring up the SelectAcquireSource() function to present user with a choice and then let them hit cancel and then call that function.. but it will happen even if I just set the acquire source programatically, just not quite as often.
Any possibility of fixing this? its not usable as is and my efforts to find a workaround haven't succeeded yet.. |
15 L A T E S T R E P L I E S (Newest First) |
fab |
Posted - Apr 07 2013 : 00:29:55 I can replicate using your exe, but unfortunately not with EXEs I compile. I am thinking about cases: 1) you are using an old ImageEn version (I am compiling using last version) 2) I set different application options (you have sent me only sources, not project files like "SelectScannerTest.cbproj")
|
mouser |
Posted - Apr 03 2013 : 03:50:29 Here's the breakpoint.. I can't get it to trace into the imageen code source, but you can see approximately where it's happening.
 |
fab |
Posted - Apr 03 2013 : 02:59:24 I'm sorry, I am not able to replicate, even with XP x64. Could you locate the exact line of code where the exception occurs? |
mouser |
Posted - Apr 02 2013 : 01:25:38 "Please confirm this sequence causes the AV in your side:"
Fabrizio if you look at the pastebin and video i posted above you will see that that exact sequence often (though not always) causes the AV.
This is on Windows XP Pro x64, C++ Builder 2007. I could try it on other OS if you think that would be useful. Im using the very latest ImageEn (I've made quite a few small changes to the ImageEn code so it's always conceivable that i messed something up but none of those changes are in scanner code or anywhere near it). |
fab |
Posted - Apr 02 2013 : 01:17:23 I'm trying to replicate in my own code. Please confirm this sequence causes the AV in your side:
ImageEnView->IO->SelectAcquireSource();
and next
r = ImageEnView1->IO->SelectedAcquireSource;
I'd like also to know: - ImageEn version - operating system (version and bits) |
mouser |
Posted - Mar 29 2013 : 02:09:07 One last followup -- I've manged to avoid the crashing exceptions by never calling any function that gets the currently selected source. So basically i use ImageEn function to fill combo box with available scanners, and then use the details of the strings inside that combo box to keep track of the scanner details.. Not pretty but it does work. |
mouser |
Posted - Mar 29 2013 : 00:42:40 Looking at the AllAquire demo source code, I see that it is actually calling to get info about the selected Scanner. So it can't be simply that I'm calling a function that the working demo does not call. I'm wondering if it could be some quirk in the code (maybe having to do with use of Variants in SelectedScanner record) that is only triggered by older version of delphi/c++ builder.. Doesn't sound fun to figure out.. |
w2m |
Posted - Mar 28 2013 : 07:29:47 I will contact Fabrizio about this... maybe he has some suggestions.
William Miller |
mouser |
Posted - Mar 28 2013 : 06:44:08 What I could try it bypassing the need to ever get the current selected scanner, by using the ImageEn generated combo box list of attached scanners, and then when user selects one i should know the source string details of the one they selected, without having to query imageen explicitly for the Selected Scanner source. |
mouser |
Posted - Mar 28 2013 : 06:37:36 Ok I've tested the AllAcquire demo and I don't seem to get any crashing.. however i note that it doesn't seem to make a call to get the Scanner Selection Source (or Source String), which is what triggers all the crashes on my pc, so perhaps it's not surprising that the demos don't show the problem.
(The reason it's important to be able to get/set using that Scanner String is so that the current scanner can be saved and loaded from configuration options without requiring user to manually reselect scanner each time program is run.)
Does that make sense? |
mouser |
Posted - Mar 28 2013 : 06:32:22 Sorry William, let me download the demos and try and report right now.
I should say that i've used the older (twain+wia specific) scanner functions from ImageEn for years, both with Twain and Wia, without any problem at all. It's only the new v4 "universal scanner" interface functions in ImageEn that are crashing. The old functions work fine. |
w2m |
Posted - Mar 28 2013 : 06:17:46 You did not answer my question. Do the demos show the same problem?
William Miller |
mouser |
Posted - Mar 27 2013 : 17:43:59 Hi William,
Thanks for replying.
I've made a little video demo and minimalist program to demonstrate the bug.
Pastebin of code from the demo (C++ Builder): http://pastebin.com/STzbkqqg
Video: http://www.donationcoder.com/Private/ibug/imageenbug.html
Complete source code to demo and executable exe: http://www.donationcoder.com/Private/ibug/SelectScannerTest.zip
This was compiled with C++ Builder 2007.
My experience with such random bugs tells me it's usually unallocated memory bug that leads to such odd random behavior.
I've spent the entire day trying to come up with clever workarounds to the crashing behavior without luck, and I spent some time walking through the cimageen source, but the aquireparams have some places where it's a little tricky to follow when they are being initialized, etc.. i kind of suspect the problem lies there somewhere, but i didn't find a solution.
Let me know what you think. |
w2m |
Posted - Mar 27 2013 : 16:37:17 Do you get the same crashes with the demos and your scanner? I nave not experienced this here with my scanner, Delphi 2010 and Windows 7.
William Miller Email: w2m@frontiernet.net EBook: http://www.imageen.com/ebook/ Apprehend: http://www.frontiernet.net/~w2m/index.html |
mouser |
Posted - Mar 27 2013 : 15:48:25 Quick comment: The new universal scanner functions definitely make it easier than the old code I had written to use wia or twain.
Unfortunately after spending a few hours converting to the new code, and now a few hours more trying to figure out some kludges to get around the crashing access violations, i'm in the unfortunate situation of having completely unusable scanning code at the moment.
I've tried just about everything to find a way around the problem but with no luck. Fabrizio, any chance you can look into this? Unless I'm really doing something wrong that I can't see, there is a giant problem with the new scanner routines that make them basically unusable. |