[Libreoffice-bugs] [Bug 115420] Crash using "Close" button for Extension Manager -> Check for Updates dialog

bugzilla-daemon at bugs.documentfoundation.org bugzilla-daemon at bugs.documentfoundation.org
Tue Mar 6 17:26:52 UTC 2018


https://bugs.documentfoundation.org/show_bug.cgi?id=115420

--- Comment #39 from Michael Meeks <michael.meeks at collabora.com> ---
Hmm - then again ... looking at the code:

vcl/win/window/salframe.cxx

It puzzles me:

WinSalFrame::~WinSalFrame()
{

    // Release Cache DC
    if ( mpGraphics2 &&
         mpGraphics2->getHDC() )
        ReleaseGraphics( mpGraphics2 );

Doesn't seem to do anything of the sort; unless mpGraphics2 == mpGraphics.

Indeed the condition:

void WinSalFrame::ReleaseGraphics( SalGraphics* pGraphics )
{
    if ( mpGraphics2 == pGraphics )
    {

Looks deeply counter-intuitive; surely that should be mpGraphics2 != pGraphics
- ie. only free it if it is different ?

I'm left puzzled by who frees mpGraphics2 - which (after all) has this timer
associated with it. Of course, that is not related to GL, and perhaps is a leak
but only when used threaded:

    WinSalGraphics*         mpGraphics;             // current frame graphics
    WinSalGraphics*         mpGraphics2;            // current frame graphics
for other threads

The rather grim extensions code being high on the awful threaded, graphical
code list of horror.

Thoughts much appreciated; I append a blind fix in case someone can reproduce
this and can compile that.

diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx
index 64b073f99139..fee8440cc700 100644
--- a/vcl/win/window/salframe.cxx
+++ b/vcl/win/window/salframe.cxx
@@ -926,6 +926,17 @@ WinSalFrame::~WinSalFrame()
          mpGraphics2->getHDC() )
         ReleaseGraphics( mpGraphics2 );

+    // Why did we never do this ?
+    if (mpGraphics2 != mpGraphics)
+    {
+        if ( mpGraphics2->getDefPal() )
+            SelectPalette( mpGraphics2->getHDC(), mpGraphics2->getDefPal(),
TRUE );
+        mpGraphics2->DeInitGraphics();
+        ReleaseDC( mhWnd, mpGraphics2->getHDC() );
+        delete mpGraphics2;
+        mpGraphics2 = nullptr;
+    }
+
     // destroy saved DC
     if ( mpGraphics )
     {

But quite possibly I'm confused =) it happens.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice-bugs/attachments/20180306/07432f12/attachment.html>


More information about the Libreoffice-bugs mailing list