mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-09 02:28:14 +02:00
* fix for mantis 37573 by Sergey Larin. Manually chain coinitialize* running into the initproc chain, executing it depth first to make it as late as possible.
git-svn-id: trunk@46450 -
This commit is contained in:
parent
cc14f06677
commit
a9f9ee43af
@ -325,6 +325,7 @@ unit ComObj;
|
||||
CoResumeClassObjects : TCoResumeClassObjectsProc = nil;
|
||||
CoSuspendClassObjects : TCoSuspendClassObjectsProc = nil;
|
||||
CoInitFlags : Longint = -1;
|
||||
CoInitDisable : Boolean = False;
|
||||
|
||||
{$ifdef DEBUG_COM}
|
||||
var printcom : boolean=true;
|
||||
@ -1877,6 +1878,20 @@ const
|
||||
Initialized : boolean = false;
|
||||
var
|
||||
Ole32Dll : HModule;
|
||||
SaveInitProc : CodePointer;
|
||||
|
||||
procedure InitComObj;
|
||||
begin
|
||||
if SaveInitProc<>nil then
|
||||
TProcedure(SaveInitProc)();
|
||||
if not CoInitDisable then
|
||||
{$ifndef wince}
|
||||
if (CoInitFlags=-1) or not(assigned(ComObj.CoInitializeEx)) then
|
||||
Initialized:=Succeeded(CoInitialize(nil))
|
||||
else
|
||||
{$endif wince}
|
||||
Initialized:=Succeeded(ComObj.CoInitializeEx(nil, CoInitFlags));
|
||||
end;
|
||||
|
||||
initialization
|
||||
Uninitializing:=false;
|
||||
@ -1893,12 +1908,10 @@ initialization
|
||||
end;
|
||||
|
||||
if not(IsLibrary) then
|
||||
{$ifndef wince}
|
||||
if (CoInitFlags=-1) or not(assigned(comobj.CoInitializeEx)) then
|
||||
Initialized:=Succeeded(CoInitialize(nil))
|
||||
else
|
||||
{$endif wince}
|
||||
Initialized:=Succeeded(comobj.CoInitializeEx(nil, CoInitFlags));
|
||||
begin
|
||||
SaveInitProc:=InitProc;
|
||||
InitProc:=@InitComObj;
|
||||
end;
|
||||
|
||||
SafeCallErrorProc:=@SafeCallErrorHandler;
|
||||
VarDispProc:=@ComObjDispatchInvoke;
|
||||
|
Loading…
Reference in New Issue
Block a user