-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Decent workaround to dirty a project after bad layer handling #8657
Conversation
cbcdafc
to
1af3845
Compare
Here's a potential alternative approach:
and then at the end of that function
This avoids the timer approach, whilst still keeping the original intention of the dirty blocking. What do you think? |
Looks good.
Do we really need this? The signal will never be emitted again after the initial bad layer handling. |
Isn't the bad layer handler tied to the life of the project instance? (I.e. forever?) |
Yes, but what are you trying to avoid here? Multiple connections to the same lambda any time |
Exactly - unique connections aren't possible with lambdas |
|
I would prefer using the standard life-cycle mechanism of event connection... e.g. connect to connectionScope variable life-cycle as proposed by @nyalldawson . I'ts a kind of trick but a clean trick (btw IMHO too many lambdas respect moving and documenting in .h private or static method, but it's a question of style) |
IMHO explicit is better than implicit: I'm generally in favor of using |
I'd have to see the code, but I don't think call once will help here. If you use it to only setup the connection on the first project read, then a permanent connection is being created with the lambda capturing a reference to a local variable - which will go out of scope after the function ends the first time and subsequent reads would crash. |
@nyalldawson you are right, I'll go for your proposed solution. |
1af3845
to
158cae3
Compare
158cae3
to
0042cc0
Compare
Fixes #20743
@nyalldawson I don't know why https://github.com/qgis/QGIS/blob/master/src/app/qgisapp.cpp#L5809 but that is basically blocking a plain
setDirty
call from within the bad layer handlers.If you can think of a better/cleaner solution than a timer (and that do not involve an API change in the bad layer handlers), please let me know.