5
$\begingroup$

WARNING: The code in this post crashes the Front End on my computer, causing all unsaved work to be lost. Be sure to save your work before trying this out!


lines = Table[Line[{{i, 0}, {i, -1}}], {i, 0.1, 1, 0.1}];
Graphics[{lines}]

enter image description here

If, however, the outer set of braces are inadvertently omitted in the Line[] as follows:

lines = Table[Line[{i, 0}, {i, -1}], {i, 0.1, 1, 0.1}];

Then Mma 12.2 crashes as soon as the Graphics command is executed. Can someone verify this? Please include your version info as well. Thanks.


$Version

"12.2.0 for Microsoft Windows (64-bit) (December 12, 2020)"

--------------------------------------------

Edit: To include InfiniteLine and HalfLine behavior with missing outer braces

(This doesn't crash my FrontEnd, but be careful on your systems)

lines2a = Table[InfiniteLine[{{i, 0}, {i, -1}}], {i, 0.1, 1, 0.1}];
lines2b = Table[InfiniteLine[{i, 0}, {i, -1}], {i, 0.1, 1, 0.1}];

lines2b has a missing set of braces.

g2a = Graphics[lines2a, Frame -> Automatic, 
   PlotRange -> {{-10, 10}, {-10, 10}}];
g2b = Graphics[lines2b, Frame -> Automatic, 
   PlotRange -> {{-10, 10}, {-10, 10}}];
GraphicsRow[{g2a, g2b}]

enter image description here

Also replacing the InfiniteLine in the above experiment with HalfLine results in the same behavior, so I won't add it again.

$\endgroup$
6
  • 2
    $\begingroup$ Yes, it crashes in 12.3.1 for Microsoft Windows (64-bit) (June 24, 2021). $\endgroup$
    – Domen
    Sep 21 at 13:18
  • 3
    $\begingroup$ Also crashes on macOS (12.2. or 12.3.1). Please report this to Wolfram. $\endgroup$
    – Szabolcs
    Sep 21 at 13:27
  • $\begingroup$ @Szabolcs, my apologies. I did include the crash tag. I had been trying to figure out what went wrong on my computer for the past several hours. $\endgroup$
    – Syed
    Sep 21 at 13:31
  • 6
    $\begingroup$ No worries, I didn't lose work this time (as I understood what was going to happen) but I have in the past. It is common that people don't read in detail before trying a few lines of code. Front End crashes are much more dangerous than kernel crashes because they lead to lost work. I added the warning for the benefit of other readers. $\endgroup$
    – Szabolcs
    Sep 21 at 13:44
  • $\begingroup$ This is a regression in the newer versions; in my v. 12.0.0 on Win10-64 this only causes the expected error. $\endgroup$
    – MarcoB
    Sep 21 at 20:07
3
$\begingroup$

Thanks for reporting the bug. This is fixed in the upcoming 13.0 release (which I expect to be shipping in the next several weeks from the time of this writing). The correct behavior for your Line example is to produce a pink box with a tooltip indicating the syntax error, and it now does.

enter image description here

Note that your InfiniteLine example does not produce a pink box because there is no syntax error. The version of InfiniteLine without the braces has a different, documented meaning.

$\endgroup$
1
  • $\begingroup$ Perfect. Many thanks. Only much later did I realize the other usage for InfiniteLine. $\endgroup$
    – Syed
    1 hour ago
0
$\begingroup$

Seems that the built-in MakeBoxes in the front-end has some trouble about precision.

This crashes my FE (12.2.0):

Graphics[{{Line[{{0.1, 0}, {0.1, -1}}], Line[{{0.2, 0}, {0.2, -1}}], 
   Line[{{0.30000000000000004, 0}, {0.30000000000000004, -1}}], 
   Line[{{0.4, 0}, {0.4, -1}}], Line[{{0.5, 0}, {0.5, -1}}], 
   Line[{{0.6, 0}, {0.6, -1}}], Line[{{0.7000000000000001, 0}, 
     {0.7000000000000001, -1}}], Line[{{0.8, 0}, {0.8, -1}}], 
   Line[{{0.9, 0}, {0.9, -1}}], Line[{{1., 0}, {1., -1}}]}}]

But these do not:

Graphics[{{Line[{{0.1, 0}, {0.1, -1}}], Line[{{0.2, 0}, {0.2, -1}}], 
   Line[{{0.3, 0}, {0.3, -1}}], 
   Line[{{0.4, 0}, {0.4, -1}}], Line[{{0.5, 0}, {0.5, -1}}], 
   Line[{{0.6, 0}, {0.6, -1}}], Line[{{0.7, 0}, 
     {0.7, -1}}], Line[{{0.8, 0}, {0.8, -1}}], 
   Line[{{0.9, 0}, {0.9, -1}}], Line[{{1., 0}, {1., -1}}]}}]
lines = Table[Line[{{i, 0}, {i, -1}}], {i, 0.1, 1, 0.1}];
ToExpression@ToBoxes@Graphics[{lines}]

BTW, Wolfram Cloud (12.3.1) won't crash.

$\endgroup$
2
  • 1
    $\begingroup$ Is this a question, or just an observation? If the latter, perhaps, it should be reported to Wolfram, Inc. $\endgroup$
    – bbgodfrey
    yesterday
  • $\begingroup$ FWIW I was unable to reproduce any crash here in 12.2 or 12.3 under Windows. And the Table version of your example which works for you produces precisely the same output cell as your crashing example. It's difficult to say exactly what you're seeing, but I think it's not as simple as a precision issue. $\endgroup$
    – John Fultz
    2 hours ago

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.