tvplanit: Fix ZEOS Datastore crashing if ZConnection is open when connected to datastore (issue #33717).

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6407 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2018-05-12 17:05:40 +00:00
parent efdc6a9ca2
commit 4d4e06ecb9
4 changed files with 20 additions and 7 deletions

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectOptions>
<Version Value="10"/>
<Version Value="11"/>
<PathDelim Value="\"/>
<General>
<SessionStorage Value="InProjectDir"/>
@ -17,9 +17,10 @@
<Version Value="2"/>
</PublishOptions>
<RunParams>
<local>
<FormatVersion Value="1"/>
</local>
<FormatVersion Value="2"/>
<Modes Count="1">
<Mode0 Name="default"/>
</Modes>
</RunParams>
<RequiredPackages Count="5">
<Item1>

View File

@ -7,7 +7,7 @@ object Form1: TForm1
ClientHeight = 686
ClientWidth = 980
OnCreate = FormCreate
LCLVersion = '1.6.4.0'
LCLVersion = '1.9.0.0'
object Panel1: TPanel
Left = 0
Height = 33
@ -160,7 +160,6 @@ object Form1: TForm1
Align = alBottom
TabStop = True
TabOrder = 1
KBNavigation = True
DateLabelFormat = 'mmmm yyyy'
DayHeadAttributes.Font.Height = -13
DayHeadAttributes.Font.Name = 'Tahoma'
@ -169,6 +168,7 @@ object Form1: TForm1
DrawingStyle = dsFlat
EventDayStyle = []
HeadAttributes.Color = clBtnFace
KBNavigation = True
OffDayColor = clSilver
SelectedDayColor = clRed
ShowEvents = True
@ -319,7 +319,7 @@ object Form1: TForm1
top = 264
end
object VpResourceEditDialog1: TVpResourceEditDialog
Version = 'v1.05'
Version = 'v1.10'
DataStore = VpZeosDatastore1
Options = []
Placement.Position = mpCenter

View File

@ -82,6 +82,8 @@ begin
ZConnection1.Database := AppendPathDelim(Application.Location) + DBFILENAME;
ZConnection1.Protocol := 'sqlite-3';
// ZConnection1.Connect; // activate this to test issue #33717
VpZeosDatastore1.Connection := ZConnection1;
VpZeosDatastore1.AutoCreate := true;
VpZeosDatastore1.Connected := true;

View File

@ -544,11 +544,21 @@ begin
exit;
// To do: clear planit lists...
if (AValue <> nil) then begin
wasConnected := AValue.Connected;
AValue.Connected := false;
end else
wasConnected := false;
if FConnection <> nil then
Connected := false;
{
if FConnection <> nil then begin
wasConnected := FConnection.Connected;
Connected := false;
end else
wasConnected := false;
}
FConnection := AValue;
FContactsTable.Connection := FConnection;
FEventsTable.Connection := FConnection;