[Libreoffice-commits] core.git: 2 commits - sw/source vcl/qa vcl/source

Michael Meeks michael.meeks at collabora.com
Wed Apr 29 12:46:12 PDT 2015


 sw/source/uibase/misc/redlndlg.cxx |    3 ++
 vcl/qa/cppunit/lifecycle.cxx       |   41 +++++++++++++++++++++++++++++++++++++
 vcl/source/control/tabctrl.cxx     |    2 -
 3 files changed, 45 insertions(+), 1 deletion(-)

New commits:
commit 4eed8e53313827f51cd97dcac7d2d437f53a2dbb
Author: Michael Meeks <michael.meeks at collabora.com>
Date:   Wed Apr 29 17:20:58 2015 +0100

    abhortive focus unit test - apparently we need visible windows for that.
    
    Change-Id: I64999eb625a4b312997ba78698710bd1acaf8da7

diff --git a/vcl/qa/cppunit/lifecycle.cxx b/vcl/qa/cppunit/lifecycle.cxx
index 4a0bebf..e23faa3 100644
--- a/vcl/qa/cppunit/lifecycle.cxx
+++ b/vcl/qa/cppunit/lifecycle.cxx
@@ -16,6 +16,7 @@
 #include <vcl/combobox.hxx>
 #include <vcl/field.hxx>
 #include <vcl/virdev.hxx>
+#include <vcl/tabctrl.hxx>
 
 class LifecycleTest : public test::BootstrapFixture
 {
@@ -31,6 +32,7 @@ public:
     void testParentedWidgets();
     void testChildDispose();
     void testPostDispose();
+    void testFocus();
 
     CPPUNIT_TEST_SUITE(LifecycleTest);
     CPPUNIT_TEST(testCast);
@@ -40,6 +42,7 @@ public:
     CPPUNIT_TEST(testParentedWidgets);
     CPPUNIT_TEST(testChildDispose);
     CPPUNIT_TEST(testPostDispose);
+    CPPUNIT_TEST(testFocus);
     CPPUNIT_TEST_SUITE_END();
 };
 
@@ -143,6 +146,44 @@ void LifecycleTest::testPostDispose()
     CPPUNIT_ASSERT(!xWin->GetWindow(0));
 }
 
+class FocusCrashPostDispose : public TabControl
+{
+public:
+    FocusCrashPostDispose(vcl::Window *pParent) :
+        TabControl(pParent, 0)
+    {
+    }
+    virtual bool PreNotify( NotifyEvent& ) SAL_OVERRIDE
+    {
+        return false;
+    }
+    virtual bool Notify( NotifyEvent& ) SAL_OVERRIDE
+    {
+//        CPPUNIT_ASSERT(false && "notify");
+        return false;
+    }
+    virtual void GetFocus() SAL_OVERRIDE
+    {
+        CPPUNIT_ASSERT(false && "get focus");
+    }
+    virtual void LoseFocus() SAL_OVERRIDE
+    {
+        CPPUNIT_ASSERT(false && "this should never be called");
+    }
+};
+
+void LifecycleTest::testFocus()
+{
+    ScopedVclPtrInstance<WorkWindow> xWin(nullptr, WB_APP|WB_STDWORK);
+    ScopedVclPtrInstance< FocusCrashPostDispose > xChild(xWin);
+    xWin->Show();
+    xChild->GrabFocus();
+    // process asynchronous ToTop
+    Scheduler::ProcessTaskScheduling(false);
+    // FIXME: really awful to test focus issues without showing windows.
+    // CPPUNIT_ASSERT(xChild->HasFocus());
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(LifecycleTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
commit 3801e50670afaf245e855e450817be8157deca08
Author: Michael Meeks <michael.meeks at collabora.com>
Date:   Wed Apr 29 17:20:21 2015 +0100

    Protect against event emission during dispose.
    
    Change-Id: I8c97fdb637a8ea4d50bef5815ef3716a4be03688

diff --git a/sw/source/uibase/misc/redlndlg.cxx b/sw/source/uibase/misc/redlndlg.cxx
index e0ba28d..49be7d8 100644
--- a/sw/source/uibase/misc/redlndlg.cxx
+++ b/sw/source/uibase/misc/redlndlg.cxx
@@ -254,6 +254,9 @@ void SwRedlineAcceptDlg::InitAuthors()
 {
     SwWrtShell* pSh = ::GetActiveView()->GetWrtShellPtr();
 
+    if (!aTabPagesCTRL)
+        return;
+
     SvxTPFilter *pFilterPage = aTabPagesCTRL->GetFilterPage();
 
     std::vector<OUString> aStrings;
diff --git a/vcl/source/control/tabctrl.cxx b/vcl/source/control/tabctrl.cxx
index 72c1357..21e6487 100644
--- a/vcl/source/control/tabctrl.cxx
+++ b/vcl/source/control/tabctrl.cxx
@@ -1357,7 +1357,7 @@ void TabControl::GetFocus()
 
 void TabControl::LoseFocus()
 {
-    if( ! mpTabCtrlData->mpListBox )
+    if( mpTabCtrlData && ! mpTabCtrlData->mpListBox )
         HideFocus();
     Control::LoseFocus();
 }


More information about the Libreoffice-commits mailing list