Age | Commit message (Collapse) | Author |
|
Whenever we have an error while pushing a gstate, we run the risk of
getting confused over how many pops we need etc.
With this commit we introduce some checking at the dev_null level that
attempts to make this behaviour consistent.
Any caller may now assume that calling an operation that pushes a clip
will always succeed. This means the only error cleanup they need to
do is to ensure that if they have pushed a clip (or begun a group, or
a mask etc) is to pop it too.
Any callee may now assume that if it throws an error during the call
to a device entrypoint that would create a group/clip/mask then no more
calls will be forthcoming until after the caller has completely finished
with that group.
This is achieved by the dev_null layer (the layer that indirects from
device calls through the device structure to the function pointers)
swallowing errors and regurgitating them later as required. A count is
kept of the number of pushes that have happened since an error
occurred during a push (including that initial one). When this count
reaches zero, the original error is regurgitated. This allows the
caller to keep the cookie correctly updated.
|
|
Thanks to zeniko for pointing out that the recent changes to
the fz_try/fz_catch macros to allow for throws in the fz_always
block had broken the exception stack overflow case.
Thanks also for the example file (nesting stack overflow.pdf),
which has now been added to the regression suite.
|
|
Throwing from within the always block is bad practice, but attempt
to cope with it gracefully.
|
|
Mountian Lion causes various different warnings to be given,
possibly because a change to clang by default. Fix them here.
|
|
Rather than specifically checking for the nesting getting too deep and
hence throwing an error, the error handling should do this for itself.
Make it so that we spot the depth being too great in the fz_try() and
throw to the fz_catch().
|
|
Previously we would run out of error stacks in the context and fail abruptly.
Now, throw an exception and hope for the best. At least this plugs any memory
leaks.
|
|
Attempt to separate public API from internal functions.
|
|
On Apple OSs setjmp/longjmp also mess with the signal handlers;
we don't use signals, so we don't need the slowdown this causes.
CLUSTER_UNTESTED as not tested on cluster.
|
|
|
|
Add explanations of how to use the macros in fitz.h.
Also included are 2 different formulations, with different strengths/
weaknesses for reference. Will remove these shortly, but I want a
reference to them in git.
Workaround bug in Mac OS Lion gcc (clang works fine).
|
|
Thanks to Zeniko for pointing this out.
|
|
Include android headers in fitz.h so we can debug.
Arrange for error throwing to output to android error stream as
well as stderr.
Change jpeg library to not use backing store. Solves bug 692473.
|
|
Also: use 'cannot' instead of 'failed to' in error messages.
|
|
|
|
When using exceptions (which are implemented using setjmp/longjmp), we
need to be careful to ensure that variable values get written back
before any exception happens.
Previously we've done that using volatile, but that produces nasty
warnings (and unduly limits the compilers freedom to optimise). Here
we introduce a new macro fz_var that passes the address of the variable
out of scope. This means that the compiler has to ensure that any
changes to its value are written back to memory before calling any
out of scope function.
|
|
The failed flag can be removed by having the fz_throw (and fz_rethrow)
functions do the popping of the stack.
|
|
|
|
|
|
Import exception handling code from WSS, modified to fit into the
fitz world.
With this code we have 'real' fz_try/fz_catch/fz_rethrow functions,
handling a fz_except type. We therefore rename the existing fz_throw/
fz_catch/fz_rethrow to be fz_error_make/fz_error_handle/fz_error_note.
We don't actually use fz_try/fz_catch/fz_rethrow yet...
|
|
The run-together words are dead! Long live the underscores!
The postscript inspired naming convention of using all run-together
words has served us well, but it is now time for more readable code.
In this commit I have also added the sed script, rename.sed, that I used
to convert the source. Use it on your patches and application code.
|
|
stack trace.
|
|
|
|
|
|
|
|
|
|
|
|
since it may be trimmed off if the message is too long to fit the buffer.
|
|
|
|
them in a dialog box.
|
|
|
|
the errors immediately.
|
|
|
|
|
|
|
|
|