Menu

#2304 Initialize of graph window size of win terminal (5.4)

None
closed-fixed
windows (20)
2021-12-25
2020-09-01
No

I tested win terminal of gp54rc1-win64-mingw.exe, it may crash as reported by Tait.

In the case wgnuplot.ini does not exist, wgnuplot says at setting term win:

Terminal type is now 'windows'
Options are '0 color solid butt enhanced standalone'

and it crashes by simple 'test' command. To specify graph size
'set term win size 640,400' explicitly, then

Terminal type is now 'windows'
Options are '0 color solid butt enhanced standalone size 640,400'

and 'test' command startup graph window correctly.

To save the file wgnuplot.ini on the textwindow, the file don't
include the entry of graph window size. To save on the graphwindow,
the size is saved in the file, but the value may not be correct:

GraphSize=1036037186 -31206

At the next wgnuplot process, 'set term win' says:

Terminal type is now 'windows'
Options are '0 color solid butt enhanced standalone wsize 1036037186,-2147483648'

and it crashes by 'test'.

I think the win terminal has the problem for initialize of graph window size.

Related

Bugs: #2123
Bugs: #2223
Bugs: #2227
Bugs: #2286
Bugs: #2301
Bugs: #2402

Discussion

  • Shigeharu TAKENO

    This problem may not occur on the binary without '-DHAVE_D2D11' (comment out the line "#DIRECT2D11"). It may be by src/win/wd2d.cpp.

     
  • Bastian Märkisch

    • labels: --> windows
    • Group: -->
    • Priority: -->
     
  • Shigeharu TAKENO

    I found one problem in wgraph.c. ReadGraphIni() function open lpgw->hGraph window by CreateWindow() by size lpgw->Size.x - lpgw->Decoration.x, lpgw->Size.y - lpgw->Decoration.y.
    But this is incorrect for the case lpgw->Size.x == CW_USEDEFAUT or lpgw->Size.y == CW_USEDEFAULT. In fact, we may avoid to crash the graph window even in the case DIRECT2D11 by attached testing patch, but it may not be correct to use CW_USEDEFAULT for lpgw->hGraph.
    And this doesn't fix the problem for saving the window size above. It may be a different problem.

     
  • Shigeharu TAKENO

    Attached patch is better than wgraph.c-1.diff. This avoids undefined value of lpgw->Canvas.{x,y} and changes lpgw->Size.{x,y} from CW_USEDEFAULT to the real value.
    But it also doesn't solve the problem above. The problem occurs for the following commands:
    set term win size 900,600 ; plot x ; set term png ; set term win
    The last command says " size 119509427,-34734". It doesn't occur by
    set term win ; plot x ; set term png ; set term win
    and
    set term win wsize 900,600 ; plot x set term png ; set term win
    This means the value lpgw->Canvas.{x,y} may be incorrect in the last command, but I don't find the point.

     
  • Shigeharu TAKENO

    I found the point. Attached patch which includes wgraph.c-2.diff may solve the problem above.

     
  • Bastian Märkisch

    • status: open --> pending-fixed
     
  • Bastian Märkisch

    Applied, with the exception of the tracking of the Canvas size. That is really only supposed to be non-zero if set via the "set term command". Thanks.

     
  • Bastian Märkisch

    • status: pending-fixed --> open
    • assigned_to: Bastian Märkisch
     
  • Bastian Märkisch

    Re-opening this tracker. Either the changes have other side effects, or there are more similar bugs. E.g. set term win standalone; clear; set term win close; set term win docked; clear fails to init the drawing area completely.
    @sfeam, I consider these bugs release-critical for 5.4.2 on Windows.

     
  • Shigeharu TAKENO

    Please try to use attached patch (lpgw->StatusHeight was calcurated to invalid value).

     
    • Bastian Märkisch

      Thanks for looking into this. There should never be an additional statusbar for the graph when the graph window is "docked", i.e. attached to the text terminal. So for me this doesn't change anything. What is the scenario where this is a problem?
      My example above failed for Direct2D 1.1 and above since the graph window never receives a WM_CLOSE. Just a WM_DESTROY. No idea why that is. Now fixed in master branch.

       
  • Shigeharu TAKENO

    I don't understand the problem on your environment. And I may use different source from you.
    I tested gnuplot-5.4.0 with wgraph-3.diff on my Windows10 machine.
    On my machine, your command "set term win standalone ..." makes docked graph window, but we can not draw any graph with warning:
    warning: Warning - difficulty fitting plot titles into key

    This may be a result of incorrect lpgw->StatusHeight at Line 501 of wgraph.c. For example, the value may be 565, then lpgw->Decoration.y will be incorrect large value (Ex.593) calcurate by wrong lpgw->StatusHeight, and the 7th argument lpgw->Size.y - lpgw->Decoration.y of CreateWindow() for lpgw->hGraph (at Line 697) will be negative value (Ex. 541-593). This makes hGraph window with height 0. then, it will occur the problem for MakeFonts() because the rect.bottom = rect.top = 0. This sets lpgw->vchar and lpgw->vtic the value -1, which is the error value of the function MulDiv().

     
  • Shigeharu TAKENO

    So, on my environment, wgraph.c-4.diff fixed the problem.

     
    • Bastian Märkisch

      Thanks for the info. I still think there is another problem since those conditions (docked and hStatusbar != NULL) should never be true at the same time. The error was due to GraphClose not being called and hence hStatusbar not being set to NULL, which is now fixed. I provide a 5.5 build in files/testing for testing.

       
  • Bastian Märkisch

    @shige-takeno, do you still have issues with version 5.4.2 or can we close this tracker?

     
  • Shigeharu TAKENO

    The problem seems to be solved in 5.4.2 windows binary. Thanks.

     
  • Bastian Märkisch

    • status: open --> pending-fixed
     
  • Bastian Märkisch

    Thank you very much for the feedback.

     
  • Ethan Merritt

    Ethan Merritt - 2021-12-25
    • Status: pending-fixed --> closed-fixed
     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.