X64 crashes

(obones) #1


We have been using Hydra successfully in our Delphi applications to display various visual plugins and up until now, we had no specific issues.
However, as we start using Hydra in 64 bits applications with high memory usage, we observe frequent crashes that prove very difficult to reproduce.
After lengthy investigations, we could not pinpoint the issue but we discovered a very troubling code inside RemObjects.Hydra.WPF\VisualPlugin.pas, more precisely, the VisualPlugin.GetHandle method.
Indeed, its return type is set as Int32 but it reads the value from Control.Handle which is a IntPtr and we know from past experience that this is the source of many elusive bugs.
That’s because on a 32bits application, or a very lightly loaded 64bits one, the handle values given by the OS never grow out of the Int32 range.
But in moderately to heavily loaded systems, the handle values can be bigger than Int32 and casting them to them leads to truncation, in turn leading to corrupting every possible things it touches.

Searching for Int32 inside Hydra code gives many usages, most of which appear legitimate, but all of them should be reviewed and clearly, the GetHandle methods should have their signatures changed to use IntPtr.

Just for testing, how can we recompile the Hydra sources?

(RemObjects) #2

Thanks, logged as bugs://78589

(antonk) #3

The Hydra itself has been develped long before the Delphi 64-bit compiler was created. Thanks for the report, we’ll investigate this immediately.

To rebuild Hydra you need to use Elements compiler available at http://www.elementscompiler.com/elements/download.aspx

(RemObjects) #4

bugs://78589 got closed with status fixed.