Jump to content

Leaderboard


Popular Content

Showing content with the highest reputation on 04/23/20 in all areas

  1. Fr0sT.Brutal

    Profiler for Delphi

    https://github.com/Fr0sT-Brutal/awesome-pascal#code-checkreview-debug
  2. Joseph MItzen

    TEmbeddedWB in a 64 Bit application

    Damn, even floating points have to wear masks right now.
  3. pro_imaj

    Delphi fmx comes standard in iOS font

    Hi, I solved the problem permanently, adding the project to pass the following file. *I add that someone might need it in the future. unit uFont; interface uses FMX.Platform, FMX.Graphics; type TmyFMXSystemFontService = class(TInterfacedObject, IFMXSystemFontService) public function GetDefaultFontFamilyName: string; function GetDefaultFontSize: Single; end; implementation function TmyFMXSystemFontService.GetDefaultFontFamilyName: string; begin Result := 'Segoe UI'; end; function TmyFMXSystemFontService.GetDefaultFontSize: Single; begin Result := 12; end; procedure InitFont; begin if TPlatformServices.Current.SupportsPlatformService(IFMXSystemFontService) then TPlatformServices.Current.RemovePlatformService(IFMXSystemFontService); TPlatformServices.Current.AddPlatformService(IFMXSystemFontService, TmyFMXSystemFontService.Create); end; initialization InitFont; end.
  4. David Heffernan

    Profiler for Delphi

    VTune works well. AQTime was an unmitigated AV fest when I last tried it.
  5. Tom F

    Profiler for Delphi

    I used AQTime for many years, but it seemed to me that SmartBear wasn't really interested in the Delphi market and their product suffered ... and was expensive. I more recently purchased Nexus Quality Suite and was very happy with it. Great tool, great support, great modern product: https://www.nexusdb.com/support/index.php?q=node/27156. As someone previously said, "You get what you pay for." NQS was well worth what we paid for it.
  6. Anders Melander

    Why this code fail?

    Yes it is. The code you have posted will leak the TFDQuery instance and not return anything.
  7. David Heffernan

    TEmbeddedWB in a 64 Bit application

    Do this for both 32 and 64 bit. Just because you might get away with it in 32 bit for now, doesn't mean you always will. And if your app doesn't need floating point exceptions unmasked then mask them. Have consistency between 32 and 64 bit.
  8. Ok, I will try, but the real reason where any why it crashes I cannot tell. I found by heavy logging in the sources that it crashes when calling the GetConnectionState method: (I added a lot of Logs around the problem zone). (System.Mac.Bluetooth) In DEBUG, After first start, Location "when using" appears, and the selection is visible in the settings: All OK the app doesn't crash, and when touching GetConnectionState first time, the Bluetooth alert appears. : All OK After first start, the Bluetooth switch is visible in the apps settings: All OK In RELEASE (only via TestFlight, not in debug w/ run), After first start, Location "when using" appears, and the selection is visible in the settings: All OK the app crashes, when touching GetConnectionState first time, no Bluetooth alert appears. : not OK After start and crash, the Bluetooth switch is NOT visible in the apps settings: not OK I use the audio, location, bluetooth-central background modes, (but the problem occurs in Foreground, ) I have set all necessary strings NSLocationAlwaysUsageDescription, NSLocationWhenInUseUsageDescription, NSLocationAlwaysAndWhenInUseUsageDescription NSBluetoothPeripheralUsageDescription , NSBluetoothAlwaysUsageDescription Here are some parts function TMacBluetoothLEManager.GetConnectionState: TBluetoothConnectionState; var LTotal: Single; begin if FAdapter = nil then FAdapter := TMacBluetoothLEAdapter.Create(Self); LMacBluetoothLEAdapter := TMacBluetoothLEAdapter(FAdapter); if LMacBluetoothLEAdapter.FLEManager.FCentralManager.state = CBCentralManagerStatePoweredOn then Result := TBluetoothConnectionState.Connected; else begin LTotal := 0; repeat InternalWaitMessage(0.05); LTotal := LTotal + 0.05; until (LTotal >= 1) or //<====== FATAL CRASH happens here, see Logs below for DEBUG/RELEASE, the request of state seems to crash in RELEASE (LMacBluetoothLEAdapter.FLEManager.FCentralManager.state = CBCentralManagerStatePoweredOn); if LMacBluetoothLEAdapter.FLEManager.FCentralManager.state = CBCentralManagerStatePoweredOn then Result := TBluetoothConnectionState.Connected else Result := TBluetoothConnectionState.Disconnected; end; end; The LOG enhanced code is function TMacBluetoothLEManager.GetConnectionState: TBluetoothConnectionState; var LTotal: Single; LMacBluetoothLEAdapter: TMacBluetoothLEAdapter; LCurrAdp : TMacBluetoothLEAdapter; //S4: 22.04.20 begin if FAdapter = nil then FAdapter := TMacBluetoothLEAdapter.Create(Self); LMacBluetoothLEAdapter := TMacBluetoothLEAdapter(FAdapter); //####### //## //S4: 22.04.20 wait until central manager fully created // PREVENT FATAL CRASH // LTotal := 0; repeat InternalWaitMessage(0.05); // Give a little delay to finish EnableBluetooth LTotal := LTotal + 0.05; // CurrentManager just reads the FManager variable LCurrAdp := LMacBluetoothLEAdapter; if Assigned( LCurrAdp ) then begin // if available, maybe still not ready yet if Assigned( LCurrAdp.FLEManager ) then begin if Assigned( LCurrAdp.FLEManager.FCentralManager ) then begin InternalWaitMessage(0.05); // Give a little more safety delay break; end; end; end; until (LTotal > 1.5 ); //This loop doesn't really cause the crash, as considered first, always leaving directly if LTotal <= 1.5 then begin S4Log.d( 'TMacBluetoothLEManager.GetConnectionState' + ' (1a) BLE State OK: ' + Format( '%2.2f', [LTotal]) ); end else begin S4Log.d( 'TMacBluetoothLEManager.GetConnectionState' + ' (1b) BLE State FAIL: ' + Format( '%2.2f', [LTotal]) ); end; // //S4: 22.04.20 try wait until central manager fully created //## //####### S4Log.d( 'TMacBluetoothLEManager.GetConnectionState' + ' (2a) Check state' ); if LMacBluetoothLEAdapter.FLEManager.FCentralManager.state = CBCentralManagerStatePoweredOn then begin S4Log.d( 'TMacBluetoothLEManager.GetConnectionState' + ' (3a) state is connected' ); Result := TBluetoothConnectionState.Connected; end else begin S4Log.d( 'TMacBluetoothLEManager.GetConnectionState' + ' (3b) state is NOT connected' ); LTotal := 0; repeat S4Log.d( 'TMacBluetoothLEManager.GetConnectionState' + ' (4a) repeat before wait' ); InternalWaitMessage(0.05); S4Log.d( 'TMacBluetoothLEManager.GetConnectionState' + ' (4b) repeat after wait' ); LTotal := LTotal + 0.05; //LMacBluetoothLEAdapter.FLEManager. until (LTotal >= 1) or //<====== FATAL CRASH happens here, see Logs below for DEBUG/RELEASE, the request of state seems to crash in RELEASE (LMacBluetoothLEAdapter.FLEManager.FCentralManager.state = CBCentralManagerStatePoweredOn); S4Log.d( 'TMacBluetoothLEManager.GetConnectionState' + ' (3c) before result' ); if LMacBluetoothLEAdapter.FLEManager.FCentralManager.state = CBCentralManagerStatePoweredOn then begin Result := TBluetoothConnectionState.Connected; S4Log.d( 'TMacBluetoothLEManager.GetConnectionState' + ' (3c) result CONN' ); end else begin Result := TBluetoothConnectionState.Disconnected; S4Log.d( 'TMacBluetoothLEManager.GetConnectionState' + ' (3d) result DISCONN' ); end; end; end; Here are the logs for DEBUG: and for RELEASE The strange thing is that is eeems to crash in the timer delay, not really the state request, but I won't rely on the logs in this fatal crah situation. The logs may be cutted in the crash. S4Log.d( 'TMacBluetoothLEManager.GetConnectionState' + ' (4a) repeat before wait' ); <===== LOG IS STILL HERE InternalWaitMessage(0.05); S4Log.d( 'TMacBluetoothLEManager.GetConnectionState' + ' (4b) repeat after wait' ); <===== LOG IS NOT HERE (CRASHED) Its very strange, because it was working well for years before, and now crashes, but only in RELEASE, DEBUG works fine. What wonders me is that even in DEBUG the state doesn't return as CONNECTED, but as disconnected. I'm pretty sure I'm missing a minor piece in the puzzle, but I cannot spot it.
  9. David Heffernan

    TEmbeddedWB in a 64 Bit application

    Isn't this just the age old issue that Delphi's RTL unmasks floating point hardware exceptions, but most other tools (including the MS tools) mask them. So the ActiveX control that implements the embedded browser expects floating point hardware exceptions to be masked and is caught out by your host having unmasked them. Resolve the problem in the traditional way by masking floating point hardware exceptions. There are countless SO posts on this subject which will show you how to do this.
  10. Fr0sT.Brutal

    Spell Checker implementation?

    https://github.com/hunspell/hunspell/blob/master/src/hunspell/hunspell.h contains about 10 functions, one of the most short APIs I ever seen xD
×