Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not allow invalid map settings #2044

Closed
wants to merge 1 commit into from

Conversation

strk
Copy link
Contributor

@strk strk commented May 19, 2015

Fix #12757
Throws QgsException on uninvertible matrix

Fix qgis#12757
Throws QgsException on uninvertible matrix
@strk
Copy link
Contributor Author

strk commented May 19, 2015

\cc @nyalldawson @rduivenvoorde

@strk
Copy link
Contributor Author

strk commented May 19, 2015

With this implementation I do get a popup (rather than an assertion failure) when going scale-wild.
The message in the popup could probably made better.

@strk
Copy link
Contributor Author

strk commented May 19, 2015

NOTE: the change involves no signature changes for easier backport to 2.8

@rduivenvoorde
Copy link
Contributor

Instead of: "Unusable (not-invertible) matrix"
maybe a more user-oriented msg, like:
"This operation on the map is not possible (anymore)"
(or ask a native speaker :-) )
@pcav any comments on this?

@strk
Copy link
Contributor Author

strk commented May 19, 2015 via email

@pcav
Copy link
Member

pcav commented May 20, 2015

@rduivenvoorde : certainly a better phrasing is necessary, invertible matrices are going to scare off people :)
Thanks @strk for the fast fix!

@wonder-sk
Copy link
Member

Could we have the implementation without the use of exceptions? Exceptions are used in QGIS code very sparsely and not expected to be thrown by ordinary code. Introducing them in a class like QgsMapToPixel may require addition of extra wrapping code everywhere where QgsMapToPixel is used.

I think the best would be to change signature of the setters to return bool instead of void.

@strk
Copy link
Contributor Author

strk commented May 20, 2015 via email

@wonder-sk
Copy link
Member

If we don't want to change the signature for 2.8, what about having one commit that will do the fix and keep the signature (will be ported to 2.8) and a followup commit that will introduce return of bool (will not be ported to 2.8) ...

@nyalldawson
Copy link
Collaborator

@wonder-sk @strk isn't changing the return type from void -> bool allowed and not classified as a break? It's been treated that way in the past. I don't see an issue with allowing that change into 2.8.

@wonder-sk
Copy link
Member

@nyalldawson yes... I think @strk mainly wanted to leave the changes in 2.8 as minimal as possible

@strk
Copy link
Contributor Author

strk commented May 21, 2015 via email

@wonder-sk
Copy link
Member

We do not really keep ABI compatibility between different versions - so it would be also fine to change the signature in 2.8 if the API does not get broken (not the case here)

@strk
Copy link
Contributor Author

strk commented May 21, 2015 via email

@rduivenvoorde
Copy link
Contributor

@strk @wonder-sk @nyalldawson @jef-n would be great if this can get fixed. Can we choose one of the fixes before 2.10 ?

@m-kuhn
Copy link
Member

m-kuhn commented Jun 16, 2015

To reanimate this PR: I think a return value is preferable to an exception.
If a return value is not handled, not much happens.
If an exception is unhandled, memory can easily be leaked.

@vmora
Copy link
Contributor

vmora commented Jun 18, 2015

@m-kuhn if RAII was used, the risk of leak with uncaught exception would be very small. I prefer code that fails noisily. But in the current state of QGIS...

grep -rn 'delete '|wc -l
2239

... what you say makes sense.

@mhugo
Copy link

mhugo commented Jun 18, 2015

... so why not the other way around ? fix exception safety and use exceptions ?

@m-kuhn
Copy link
Member

m-kuhn commented Jun 18, 2015

was that an offer? :)

@wonder-sk
Copy link
Member

Cherry-picked manually and de-exception-ified in 1bf9844

Thanks Sandro et al

@wonder-sk wonder-sk closed this Jun 19, 2015
@qgib qgib mentioned this pull request May 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants