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

View File

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

View File

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

View File

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