User Changes 2.4.4

From Lazarus wiki
Jump to navigationJump to search

About this page

Below you can find a list of intentional changes since the previous release that can change the behaviour of previously working code, along with why these changes were performed and how you can adapt your code if you are affected by them.

Unit changes

OpenSSL

  • Old behaviour: The openssl unit contained an EVP_PKEY type.
  • New behaviour: The EVP_PKEY type has been renamed into PEVP_PKEY.
  • Reason: Consistency with other similar types and with the original C declaration.
  • Remedy: Make the same typename change in your source code.

Graph unit aspect ratio changes in Arc and PieSlice

  • Old behaviour: Graph unit procedures Arc and PieSlice always assumed a 1:1 aspect ratio, regardless of current mode's aspect ratio.
  • New behaviour: Arc and PieSlice now respect the current aspect ratio.
  • Reason: Borland Pascal compatibility; better (i.e. more 'circular') looks of arcs and pie slices in modes with weird aspect ratios like 640x200; consistency with the Circle procedure, which already respects the current aspect ratio.
  • Remedy: This change is only likely to affect you, if you use a graphical mode with an aspect ratio, different than 1:1. Note that VGA 640x480 and higher modes usually always have a 1:1 aspect ratio. 320x200, 640x200, 640x350 and 640x400, however, do not. If you use one of these modes and, for some reason, don't want aspect ratio compensation in Arc and PieSlice, either call:
SetAspectRatio(10000, 10000)

immediately after InitGraph (this will also change the behaviour of Circle) or replace:

Arc(X, Y, StAngle, EndAngle, Radius) with Ellipse(X, Y, StAngle, EndAngle, Radius, Radius)

and

PieSlice(X, Y, StAngle, EndAngle, Radius) with Sector(X, Y, StAngle, EndAngle, Radius, Radius)

Graph unit aspect ratio changes in GraphDefaults

  • Old behaviour: The GraphDefaults procedure used to reset the current aspect ratio to 1:1, regardless of the current mode's default aspect ratio.
  • New behaviour: GraphDefaults no longer changes the current aspect ratio.
  • Reason: Borland Pascal compatibility; bug fix for applications that call GraphDefaults in modes with an aspect ratio different than 1:1 and still want to use aspect ratio compensation, since the old behaviour effectively disabled any aspect ratio compensation.
  • Remedy: If you want to reset the current aspect ratio to 1:1, just call:
SetAspectRatio(10000, 10000)

TThread.Suspend and TThread.Resume have been deprecated

  • Old behaviour: TThread.Suspend suspended the thread if the platform supported it, while TThread.Resume would resume an explicitly suspended thread, or a thread created as "suspended".
  • New behaviour: Suspending running threads has been deprecated. Creating threads suspended is still supported, and a new TThread.Start method has been added to tell such threads that they can start running.
  • Reason: Embarcadero Delphi (D2010+) compatibility, and the fact that arbitrarily suspending running threads is unsupported on most platforms because of inherent deadlock problems. Related concerns presumably played part in Embarcadero's decision. Such functionality was also removed from Java for similar reasons.
  • Remedy: For threads created as suspended, replace resume with start. For suspending running threads: rewrite so this functionality is no longer needed. Note that there are no short term plans to remove resume to start suspended threads. If you want to share code with old Delphi versions, using resume will remain working for starting threads that were created as suspended for several FPC releases to come. Just ignore the warning.

Default TFPPixelCanvas brush style

  • Old behaviour: A brush in TFPPixelCanvas would start with the style bsClear
  • New behaviour: Now it starts with the style bsSolid
  • Reason: Starting with bsSolid is more intuitive and is also the state in which LCL brushes start.
  • Remedy: Initialize the brush to bsClear after creating your TFPPixelCanvas if your code depended on it starting in this state.

Glut.FreeGlut function renamed to UnloadGlut

  • Old behaviour: Glut unit contained a function called FreeGlut.
  • New behaviour: This function is now renamed to UnloadGlut.
  • Reason: We now include a FreeGlut unit, exposing http://freeglut.sourceforge.net/ -specific functionality. Function name "FreeGlut" inside Glut unit would cause name clashes and confusion (as it's not related to freeglut library).
  • Remedy: Make the same rename in your source code.

xmlxsd unit split into xmlxsd and xmlxsdparser

  • Old behaviour: xmlxsd contained functions for parsing xml xsd types and helper functions for libxml2.
  • New behaviour: xmlxsd contains only the helper functions for libxml2, all the parser functions are moved to the xmlxsdparser unit.
  • Reason: xmlxsd allways required the external library libxml2. But if somebody was using just the xsd type parser code, he had to include the libxml2 library also. Now all the xsd type parser functions are in xmlxsdparser. This new unit is not depandant of the external libxml2 library.
  • Remedy: If you are interested in the full libxml2 and xsd functionality, simply add xmlxsdparser to the uses list (besides xmlxsd). If you are interested only in the xsd type parser code, remove xmlxsd (and maybe libxml2) unit and use only xmlxsdparser.

Previous release notes