View Issue Details

IDProjectCategoryView StatusLast Update
0003518JEDI VCL00 JVCL Componentspublic2006-04-05 01:19
ReporterfikretAssigned Toobones 
PrioritynormalSeveritycrashReproducibilityalways
Status resolvedResolutionfixed 
Product Version3.10 
Target VersionFixed in Version3.30 
Summary0003518: TJvDBDateTimePicker crashes BDS 2006
DescriptionJust drop TJvDBDateTimePicker on form, and try to leave form, your
mouse cannot leave that region, and you cannot do anything. If you use
ALT-TAB, you can change active app, but your mouse will stay in that
region. It will give many error messages, and BDS2006 will crash.
Additional InformationI have reproduced this error on 3 computers,
with released JVCL3 and with CVS version.
TagsNo tags attached.

Relationships

has duplicate 0003626 resolvedobones JvDBDatePicker Exception: Read of address 00000000 At DesignTime 

Activities

willhonor

2006-03-14 08:14

reporter   ~0008664

This is caused by the WMPaint method in TJvDateTimePicker. There is no checking done to see if the datalink is setup before using it. I have added the following (Rough) code which has cured the problem for me.
  Regards,
    Will.

procedure TJvDBDateTimePicker.WMPaint(var Msg: TWMPaint);
var
  D: TDateTime;
  ST: TSystemTime;
begin
  if not (csPaintCopy in ControlState) then
    inherited
  else
  begin
    d := 0 ; //###Add this line###
    if assigned(FDatalink) then //###Add this line###
    try //###Add this line###
      if Kind = dtkDate then
      begin
        if IsDateAndTimeField then
          D := FDataLink.Field.AsDateTime
        else
          D := Trunc(FDataLink.Field.AsDateTime);
      end
      else
      begin
        if IsDateAndTimeField then
          D := FDataLink.Field.AsDateTime
        else
          D := Frac(FDataLink.Field.AsDateTime);
      end;
    except //###Add this line###
      D := 0 ; //###Add this line###
    end; //###Add this line###

    DateTimeToSystemTime(D, ST);
    DateTime_SetSystemTime(FPaintControl.Handle, GDT_VALID, ST);
    SendMessage(FPaintControl.Handle, WM_ERASEBKGND, Msg.DC, 0);
    SendMessage(FPaintControl.Handle, WM_PAINT, Msg.DC, 0);
  end;
end;

obones

2006-03-16 11:14

administrator   ~0008675

The try except is not acceptable, but thanks for tracking it down to WM_PAINT. I'll assess that a little later on.

obones

2006-03-31 00:24

administrator   ~0008778

Well, that's what I thought. FDataLink is created in the constructor, but it's FDataLink.Field that can be nil. Testing for it and setting D to Now (default value for Date Edits) solves this.
It will be put in CVS as soon as it is fixed as SourceForge: http://sourceforge.net/docman/display_doc.php?docid=2352&group_id=1

obones

2006-04-05 01:19

administrator   ~0008929

This is now in CVS

Issue History

Date Modified Username Field Change
2006-02-17 02:04 fikret New Issue
2006-03-14 08:14 willhonor Note Added: 0008664
2006-03-16 11:14 obones Note Added: 0008675
2006-03-16 11:14 obones Status new => confirmed
2006-03-31 00:24 obones Note Added: 0008778
2006-04-05 01:19 obones Status confirmed => resolved
2006-04-05 01:19 obones Resolution open => fixed
2006-04-05 01:19 obones Assigned To => obones
2006-04-05 01:19 obones Note Added: 0008929
2006-04-06 09:04 obones Relationship added has duplicate 0003626