IDE: Prevent a crash with QT widgetset when debugging was started by button and debug desktop was applied. Patch from Ondrej Pokorny.

git-svn-id: trunk@49541 -
This commit is contained in:
juha 2015-07-13 10:08:33 +00:00
parent c6602ebcef
commit 0a78d2b1ae
2 changed files with 17 additions and 3 deletions

View File

@ -3567,12 +3567,14 @@ begin
MainIDEBar.Close;
end;
if not IDEIsClosing then
if not IDEIsClosing and MainIDEBar.HandleAllocated then
begin
//we need to detach the desktop change from current message process
// -> we post another message to the queue
if (ToolStatus = itDebugger) then
EnvironmentOptions.EnableDebugDesktop
PostMessage(MainIDEBar.Handle, LM_TOGGLE_DEBUG_DESKTOP, 0, 1)
else if (ToolStatus <> itExiting) then
EnvironmentOptions.DisableDebugDesktop;
PostMessage(MainIDEBar.Handle, LM_TOGGLE_DEBUG_DESKTOP, 0, 0);
end;
end;

View File

@ -44,6 +44,9 @@ uses
ProjectIntf, NewItemIntf, MenuIntf, LazIDEIntf, IDEWindowIntf, IDEImagesIntf,
LazFileCache, EnvironmentOpts, LazarusIDEStrConsts, ComponentReg, IdeCoolbarData;
const
LM_TOGGLE_DEBUG_DESKTOP = LM_USER + 101;
type
{ TMainIDEBar }
@ -64,6 +67,7 @@ type
procedure DoShow; override;
procedure WndProc(var Message: TLMessage); override;
procedure Resizing(State: TWindowState); override;
procedure ToggleDebugDesktop(var Msg: TLMessage); message LM_TOGGLE_DEBUG_DESKTOP;
public
ApplicationIsActivate: boolean;
LastCompPaletteForm: TCustomForm;
@ -786,6 +790,14 @@ begin
//??? CurShowHint:=EnvironmentOptions.ShowHintsForMainSpeedButtons;
end;
procedure TMainIDEBar.ToggleDebugDesktop(var Msg: TLMessage);
begin
if (Msg.lParam = 1) then
EnvironmentOptions.EnableDebugDesktop
else
EnvironmentOptions.DisableDebugDesktop;
end;
procedure TMainIDEBar.UpdateIDEComponentPalette(IfFormChanged: boolean);
var
OldLastCompPaletteForm, LastActiveForm: TCustomForm;