Bug 345754 - Lockup extending a perspective grid
Summary: Lockup extending a perspective grid
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: Tools (show other bugs)
Version: 2.9.1
Platform: Microsoft Windows Other
: NOR crash
Target Milestone: ---
Assignee: wolthera
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-04-01 11:36 UTC by guruguru.sp
Modified: 2015-06-06 06:27 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Screencapture of freeze (1.60 MB, application/x-shockwave-flash)
2015-04-01 11:37 UTC, guruguru.sp
Details
Simpler_lockup_step (1.79 MB, application/x-shockwave-flash)
2015-04-01 12:19 UTC, guruguru.sp
Details
Test template (43.28 KB, image/png)
2015-04-01 12:20 UTC, guruguru.sp
Details
I can't get a gdb report with above steps (after 'gdb attach <ID>' it complains the file is not found). So I started Krita through gdb, hit 'CTRL+C' and did 'thread apply all bt'. See attachment. (15.87 KB, text/plain)
2015-04-08 11:44 UTC, mvowada
Details
Video example. (628.19 KB, video/mp4)
2015-06-05 13:18 UTC, mvowada
Details
Video example with assistant previews turned off. (705.00 KB, video/mp4)
2015-06-05 16:54 UTC, mvowada
Details
gdb threads. (13.00 KB, text/plain)
2015-06-05 17:16 UTC, wolthera
Details

Note You need to log in before you can comment on or make changes to this bug.
Description guruguru.sp 2015-04-01 11:36:13 UTC
Sometimes, extending a perspective grid lock up Krita. 

Reproducible: Sometimes

Steps to Reproduce:
1.Place a Perspective ruler
2.Extend the ruler to many direction quickly towards various direction


Actual Results:  
Krita locks up on mouse release. Midpoint of the last extended grid seems to be missing.

Expected Results:  
Krita does not lock up.

So far I only managed to repro this with quick operation with tablet.
Comment 1 guruguru.sp 2015-04-01 11:37:21 UTC
Created attachment 91841 [details]
Screencapture of freeze
Comment 2 guruguru.sp 2015-04-01 12:19:43 UTC
Created attachment 91842 [details]
Simpler_lockup_step

Create a perspective grid using the attached image as template, grab right mid point to start extending. Trying to extend it around(to the right and to the left), Krita suddenly locks up. Can repro with mouse as well.
Comment 3 guruguru.sp 2015-04-01 12:20:15 UTC
Created attachment 91843 [details]
Test template
Comment 4 mvowada 2015-04-01 12:48:05 UTC
Yes. I'm able to reproduce this with Krita: 2.9.1 (git 1115da8) - Ubuntu 14.04 Unity.
Krita hangs by clicking and dragging a midpoint of one of the edges of the perspective assistant. At some point, Krita doesn't respond and you have to kill the program to exit.
Comment 5 Halla Rempt 2015-04-08 09:15:57 UTC
Have you been able to get a backtrace by attaching gdb when Krita hangs?

Something like,

ps ax | grep krita

on the command line will give 

23390 pts/1    Sl+    0:05 krita

Then, 

gdb attach 23390 (you will have a different number)

Will land you in the gdb prompt where you can do

thread apply all bt
Comment 6 mvowada 2015-04-08 11:44:03 UTC
Created attachment 91942 [details]
I can't get a gdb report with above steps (after 'gdb attach <ID>' it complains the file is not found). So I started Krita through gdb, hit 'CTRL+C' and did 'thread apply all bt'. See attachment.
Comment 7 mvowada 2015-04-08 12:07:30 UTC
...I didn't explained well. I feel to clarify a bit further:

In this case, if I run Krita through gdb when the window freezes, no error is reported in the terminal (no error = no gdb prompt). 
That is: even though I'm still able to enter (type+enter) the command "thread apply all bt" in the terminal,  nothing seems to happen. 

So I've hit 'CTRL+C' to get the gdb prompt back and then issued the command "thread apply all bt" to create the gdb report. 

I'm not sure if 'CTRL+C' interferes with the generation of the report. Please, let me know and I will be more than glad to help.
Comment 8 wolthera 2015-04-12 12:57:39 UTC
I think it may have something to do with the assistant previews, but it's weird, because those rely on the same code that the two little X shapes marking the vanishing points rely on, and the vanishing point assistant doesn't have this issue :/

Maybe remove previews from perspective alltogether?
Comment 9 wolthera 2015-05-29 18:46:10 UTC
I have an idea for this one (Basically, avoid having the lines be determined when the angle of the points is too vertical or horizontal), but it'll need to wait till my exams are over.
Comment 10 wolthera 2015-06-05 11:28:28 UTC
Git commit 064536486d16967ece781588660a22669ba76bac by Wolthera van Hovell.
Committed on 05/06/2015 at 11:28.
Pushed by woltherav into branch 'calligra/2.9'.

This was caused by an attempt to calculate the intersection on two nearly
parallel lines. The fix is of course to not do the calculation when two
lines are practically parallel.

M  +31   -26   krita/plugins/assistants/RulerAssistant/PerspectiveAssistant.cc

http://commits.kde.org/calligra/064536486d16967ece781588660a22669ba76bac
Comment 11 wolthera 2015-06-05 11:28:28 UTC
Git commit 064536486d16967ece781588660a22669ba76bac by Wolthera van Hovell.
Committed on 05/06/2015 at 11:28.
Pushed by woltherav into branch 'calligra/2.9'.

This was caused by an attempt to calculate the intersection on two nearly
parallel lines. The fix is of course to not do the calculation when two
lines are practically parallel.

M  +31   -26   krita/plugins/assistants/RulerAssistant/PerspectiveAssistant.cc

http://commits.kde.org/calligra/064536486d16967ece781588660a22669ba76bac
Comment 12 mvowada 2015-06-05 13:18:24 UTC
Created attachment 93020 [details]
Video example.

Hi wolthera :)
hope your exams went well and thank you for updating.

On my part I've tried with the last commit but it seems that a problem is still present. I'm attaching a video example. The program seems to freeze.

P.S.: When the freeze occurs I'm not sure how to get a proper gdb report. I'm not sure that would be the right procedure by doing CTRL+C and get the output of "then thread apply all bt".
Comment 13 wolthera 2015-06-05 13:34:56 UTC
Git commit 1ea16431b21240358a779ec32bd79c5930423cee by Wolthera van Hovell.
Committed on 05/06/2015 at 13:32.
Pushed by woltherav into branch 'calligra/2.9'.

This should prevent lockups on computer with higher resolution than mine.

M  +3    -3    krita/plugins/assistants/RulerAssistant/PerspectiveAssistant.cc

http://commits.kde.org/calligra/1ea16431b21240358a779ec32bd79c5930423cee
Comment 14 mvowada 2015-06-05 16:03:21 UTC
Hm, it seems I can reproduce it again... I'll try again with a clean build of Krita. These are the terminal output lines when the program freezes up (tested at first start soon after updating, with default document and prefs):

[code]FIXME: handle dialog end. 
uint DBusMenuExporterDBus::GetLayout(int, int, const QStringList&, DBusMenuLayoutItem&): Condition failed: menu 
uint DBusMenuExporterDBus::GetLayout(int, int, const QStringList&, DBusMenuLayoutItem&): Condition failed: menu 
QSpiAccessible::accessibleEvent not handled:  "8008"  obj:  QObject(0x0)  " invalid interface!" 
QSpiAccessible::accessibleEvent not handled:  "8008"  obj:  QObject(0x0)  " invalid interface!" 
QSpiAccessible::accessibleEvent not handled:  "8008"  obj:  QObject(0x0)  " invalid interface!"[/code]
Comment 15 wolthera 2015-06-05 16:13:02 UTC
mwowada, can you or can't you reproduce it when you turn off assistant previews under view?

Because it might be something different from what I suspect it is...
Comment 16 mvowada 2015-06-05 16:54:56 UTC
Created attachment 93023 [details]
Video example with assistant previews turned off.

I'm sorry, it seems I can still reproduce it also with assistant previews turned off (video).
No luck with a clean build.
Comment 17 wolthera 2015-06-05 16:59:31 UTC
Git commit c0f4f2fabea1294e7839f44f2e7e80c74028e838 by Wolthera van Hovell.
Committed on 05/06/2015 at 16:58.
Pushed by woltherav into branch 'calligra/2.9'.

Another attempt at fixing lockups.

If this doesn't work I am fresh out of ideas.

M  +8    -4    krita/plugins/assistants/RulerAssistant/PerspectiveAssistant.cc

http://commits.kde.org/calligra/c0f4f2fabea1294e7839f44f2e7e80c74028e838
Comment 18 wolthera 2015-06-05 17:00:14 UTC
Thank you very much. I tried one last thing, and if this doesn't fix it the issue is somewhere else entirely, and we'll need a backtrace.
Comment 19 wolthera 2015-06-05 17:16:40 UTC
Created attachment 93024 [details]
gdb threads.

Never mind, I can reproduce myself...

I have no idea what is going on here...
Comment 20 wolthera 2015-06-05 17:55:14 UTC
Git commit aede3037897c6974a39b05272c8ad34f4dcf99eb by Wolthera van Hovell.
Committed on 05/06/2015 at 17:50.
Pushed by woltherav into branch 'calligra/2.9'.
Related: bug 120, bug 300

As indicated by the commit message the issue was that in 360 degrees there's always
two values which can be parallel. Fixed with an fmod.

I can now not reproduce this bug any more. The downside of course is that
perspective squares with parallel sides don't do preview lines for that side, but we
can look at that in the future.

M  +4    -4    krita/plugins/assistants/RulerAssistant/PerspectiveAssistant.cc
M  +1    -1    krita/plugins/assistants/RulerAssistant/kis_ruler_assistant_tool.cc

http://commits.kde.org/calligra/aede3037897c6974a39b05272c8ad34f4dcf99eb
Comment 21 wolthera 2015-06-05 17:59:41 UTC
Mvowada, it is fixed for me now, hope it is fixed for you too!

My apologies that mention bugs 120 and 300 may have led to people being mailed. I wasn't aware that arbitrary mentions of numbers would do that :(
Comment 22 mvowada 2015-06-06 06:27:47 UTC
Oh yes, it works beautifully now.
Thank you for everything!