Jump to content

All my products and services are free. All my costs are met by donations I receive from my users. If you enjoy using any of my products, please donate to support me. Thank you for your support. Tom Speirs

Patreon

Quick Bug Report: Crash on zero sized images.


jagger1973

Recommended Posts

PinballX was crashing frequently and noticed it was scrolling around the same game... Since the log wasn't particularly helpful, I pulled out sysinternals process monitor to figure out what it was doing.

I eventually discovered that a wheel (playfield/bg) image that was properly named but had a size of zero bytes was the culprit to the crashing. I re-downloaded the image file and put it and place and PinballX no longer crashed.

FYI: This zero sized image file was also causing issues with the GameEditor

Link to comment
Share on other sites

Imagine the memory and the amount of time we're talking here to validate every last user image in pbx... :/

Link to comment
Share on other sites

Imagine the memory and the amount of time we're talking here to validate every last user image in pbx... :/

I can tell you don't really program by that statement. So let me explain..... Within Pinballx's main thread there is a call create a Direct2D.Direct2d.Surface object, this takes a filename (derived from the visual pinball.xml) and some other params.... This trickles down to a call to System.Drawing.Bitmap which throws an exception because the file is not a vaild bitmap. (In my case, it was a corrupted transfer from my file server to my cabinet which left a zero length file.) Now a good way to handle this is to catch the execption and log "File XXXXXX.png is not a valid image file" and you *could* fallback to to the "No table image" or "no wheel image file" and continue as normal. Or spit up a MsgBox. Or log it and exit.... Give the user some semblance of what the problem is. The incorrect way to handle it is not catch the exception and crash out of the program give the user no indication on why the program crashed.

You don't have to code in every image combination that could possible be used in order to validate them, you just need to catch a generic exception and handle it gracefully.

Anyway, the bug was reported and the author said his piece that it won't be fixed..... Not much I can do about it.

Link to comment
Share on other sites

Huh. You obviously didn't do your research if you think I know nothing about programming.

If the solution is that simple, why not just parse and remove any incompatible images yourself with your own code?

To be honest and fair, I get what you're saying. I didn't say you need to validate every image combination, but do you not agree that it takes calculations away from the cpu to check every image as it gets displayed? Or worse yet, cause a lag when navigating?

I've been using PBX's sister program GameEx for a long time. I'm sure they use similar code for rendering. I have never had to assist anyone with any such problem. You're suggesting a check be put in place for a one in a million error.

That aside, yes, you did report the bug. I know Tom real well, and I'm sure he's got a really sensible reason why he can't trap this exception or he would. Or he would probably log out the exception thrown as opposed to crashing out. A MsgBox would steal the programs focus since its a dialog window, I can only imagine how well that would go over. Or even closing gracefully, there would still be users who can't figure out why it's closing itself every time it gets to Pinbot in the list. And they still won't post a log when they report it.

I'm sorry that I don't "understand" how these things "work", but if it were me I would just do "something" on my own that would validate all my images, and then put it out for the whole community to use... It wouldn't take long at all to do program something to try a conversion attempt on all your images and delete the ones that throw an exception, and would really make it easier to help guarantee the crashing stops.

No offense, but I still think validating every image as it "goes by" is still a waste of cpu cycles when the user could pretty much discern the image at fault by when the crash comes, much like you did on your setup. ;)

Link to comment
Share on other sites

Just as a point of reference. ;)

I understand what you're saying; catching the exception and handling this exception in a graceful fashion doesn't seem like it would be a big deal, but OTOH none of us are the architect for PinballX. If Tom says it can't (or won't) be done, I can assure you that it's not because he's dragging his feet or trying to "stick it to the user base". Thanks for reporting the issue, and I'm sure Tom thoroughly looked into the issue before reporting back.

Just because I can be pretty daft at times you'll have to humor me - what purpose do these zero length images serve anyway? Wouldn't a 1px transparent PNG be preferable under most circumstances?

Link to comment
Share on other sites

Just because I can be pretty daft at times you'll have to humor me - what purpose do these zero length images serve anyway? Wouldn't a 1px transparent PNG be preferable under most circumstances?

My zero based image was due to a file transfer failure. Completely unintentional. But this would occur on any image that System..Bitmap couldn't detect as a legit image; thus why I wanted to report the bug. It really could throw the non-technical folks who can't debug things into a tizzy and keep them away from using PinballX. Why would you want to scare folks away from the best front end due to a minor issue....

Link to comment
Share on other sites

@Jagger1973 - Please test the next version to confirm working correctly for you. I understand your passion for the front end and your concerns/frustration with the error you received, however, please understand that we are equally passionate about providing a top-notch product and giving of our time to support it and try to troubleshoot. Your response to Tom and Adultery was a bit off-putting and could be construed as insulting - hence the responses you received.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...