Yesterday, in the email thread entitled "FYI: The OO 4.1.4 Mac problem",
Dave Fisher asked me for help with the problem where the "Create Table in
Design View" does nothing on a Mac release.

Was the problem fixed in the meanwhile? Is there another problem? What
happened? Do you still need my help?

Thank you
Damjan

On Sat, Nov 18, 2017 at 5:47 AM, Patricia Shanahan <p...@acm.org> wrote:

> Is it possible that this is another manifestation of
> https://bz.apache.org/ooo/show_bug.cgi?id=127581
>
> If so, it will not happen in the trunk.
>
>
> On 11/17/2017 10:47 AM, Damjan Jovanovic wrote:
>
>> tl;dr:
>> Put a breakpoint on dbaui::DatabaseObjectView::doDispatch or
>> /full/path/to/main/dbaccess/source/ui/misc/databaseobjectview.cxx:120
>> just
>> before you click the "Create Table..." button.
>> Step through it in your debugger line by line and document how for you
>> get.
>> Then recursively repeat and step deeper and deeper into the last statement
>> before the exception is thrown, until you narrow down the failure at its
>> source.
>> A debug build of main/dbaccess may also help ("build debug=true" in
>> main/dbaccess).
>> Email us back with your findings.
>>
>> The long version:
>> ----------------------
>>
>> Opening the "Create Table in Design View" dialog and attaching GDB and
>> running "thread apply all bt" doesn't show anything useful, so we go
>> through the source instead.
>>
>> The text "Create Table in Design View" must come from somewhere:
>>
>> [main/dbaccess]$ grep "Create Table in Design View" * -R
>> source/ui/app/app.src:    Text [ en-US ] = "Create Table in Design
>> View..."
>> ;
>>
>> Looking at that file we see:
>>
>> String RID_STR_NEW_TABLE
>> {
>>          Text [ en-US ] = "Create Table in Design View..." ;
>> };
>>
>> Now look for RID_STR_NEW_TABLE:
>>
>> [main/dbaccess]$ grep RID_STR_NEW_TABLE * -R
>> source/ui/app/app.src:String RID_STR_NEW_TABLE
>> source/ui/app/app.src:String RID_STR_NEW_TABLE_AUTO
>> source/ui/app/dbu_app.hrc:#define RID_STR_NEW_TABLE
>> RID_STR_APP_START + 4
>> source/ui/app/dbu_app.hrc:#define RID_STR_NEW_TABLE_AUTO
>> RID_STR_APP_START + 5
>> source/ui/app/AppDetailView.cxx:        rList.push_back( TaskEntry(
>> ".uno:DBNewTable", RID_STR_TABLES_HELP_TEXT_DESIGN, RID_STR_NEW_TABLE )
>> );
>> source/ui/app/AppDetailView.cxx:        rList.push_back( TaskEntry(
>> ".uno:DBNewTableAutoPilot", RID_STR_TABLES_HELP_TEXT_WIZARD,
>> RID_STR_NEW_TABLE_AUTO ) );
>>
>> Only the source/ui/app/AppDetailView.cxx is useful, as it contains actual
>> code. This is what it does:
>>
>>      switch ( _eType )
>>      {
>>      case E_TABLE:
>>          rList.push_back( TaskEntry( ".uno:DBNewTable",
>> RID_STR_TABLES_HELP_TEXT_DESIGN, RID_STR_NEW_TABLE ) );
>>          rList.push_back( TaskEntry( ".uno:DBNewTableAutoPilot",
>> RID_STR_TABLES_HELP_TEXT_WIZARD, RID_STR_NEW_TABLE_AUTO ) );
>>          rList.push_back( TaskEntry( ".uno:DBNewView",
>> RID_STR_VIEWS_HELP_TEXT_DESIGN, RID_STR_NEW_VIEW, true ) );
>>          _rData.nTitleId = RID_STR_TABLES_CONTAINER;
>>          break;
>>
>> which doesn't help much. But it does link it to ".uno:DBNewTable". Where
>> else is that used?
>>
>> [main/dbaccess]$ grep "\.uno:DBNewTable" * -R
>> source/ui/control/toolboxcontroller.cxx:
>> m_aStates.insert(TCommandState::value_type(::rtl::OUString(
>> RTL_CONSTASCII_USTRINGPARAM(".uno:DBNewTable"))          ,sal_True));
>> source/ui/app/AppController.cxx:    implDescribeSupportedFeature(
>> ".uno:DBNewTable",         ID_NEW_TABLE_DESIGN,       CommandGroup::INSERT
>> );
>> source/ui/app/AppController.cxx:    implDescribeSupportedFeature(
>> ".uno:DBNewTableAutoPilot",ID_NEW_TABLE_DESIGN_AUTO_PILOT,
>> source/ui/app/app.src:            Command = ".uno:DBNewTable";
>> source/ui/app/AppDetailView.cxx:        rList.push_back( TaskEntry(
>> ".uno:DBNewTable", RID_STR_TABLES_HELP_TEXT_DESIGN, RID_STR_NEW_TABLE )
>> );
>> source/ui/app/AppDetailView.cxx:        rList.push_back( TaskEntry(
>> ".uno:DBNewTableAutoPilot", RID_STR_TABLES_HELP_TEXT_WIZARD,
>> RID_STR_NEW_TABLE_AUTO ) );
>> uiconfig/dbapp/menubar/menubar.xml:            <menu:menuitem
>> menu:id=".uno:DBNewTable"/>
>>
>> Here we have a number of matches. The menubar.xml is related to the GUI
>> layout, we want the code. The app.src we've already looked at. That only
>> leaves toolboxcontroller.cxx, AppController.cxx and AppDetailView.cxx.
>> AppDetailView.cxx only uses ".uno:DBNewTable" for what we've already seen,
>> to add it to rList. toolboxcontroller.cxx also only uses that string in
>> some initialization code. So through a process of elimination, we're only
>> left with AppController.cxx.
>>
>> It contains only 1 matching line:
>>
>>      implDescribeSupportedFeature( ".uno:DBNewTable",
>> ID_NEW_TABLE_DESIGN,       CommandGroup::INSERT );
>>
>> We continue on with this ID_NEW_TABLE_DESIGN:
>>
>> [main/dbaccess]$ grep ID_NEW_TABLE_DESIGN * -R
>> source/ui/app/AppController.cxx:            case ID_NEW_TABLE_DESIGN:
>> source/ui/app/AppController.cxx:            case
>> ID_NEW_TABLE_DESIGN_AUTO_PILOT:
>> source/ui/app/AppController.cxx:            case
>> ID_NEW_TABLE_DESIGN_AUTO_PILOT:
>> source/ui/app/AppController.cxx:            case ID_NEW_TABLE_DESIGN:
>> source/ui/app/AppController.cxx:                         case
>> ID_NEW_TABLE_DESIGN_AUTO_PILOT:
>> source/ui/app/AppController.cxx:                        case
>> ID_NEW_TABLE_DESIGN:
>> source/ui/app/AppController.cxx:    implDescribeSupportedFeature(
>> ".uno:DBNewTable",         ID_NEW_TABLE_DESIGN,       CommandGroup::INSERT
>> );
>> source/ui/app/AppController.cxx:    implDescribeSupportedFeature(
>> ".uno:DBNewTableAutoPilot",ID_NEW_TABLE_DESIGN_AUTO_PILOT,
>> source/ui/app/app.src:            MID_NEW_TABLE_DESIGN
>> source/ui/inc/browserids.hxx:#define ID_NEW_TABLE_DESIGN
>> 25
>> source/ui/inc/browserids.hxx:#define ID_NEW_TABLE_DESIGN_AUTO_PILOT
>> 45
>> source/ui/inc/toolbox_tmpl.hrc:#define MID_NEW_TABLE_DESIGN \
>> source/ui/inc/toolbox_tmpl.hrc:    Identifier = ID_NEW_TABLE_DESIGN;    \
>>
>> The only source code file is, again, source/ui/app/AppController.cxx. The
>> string ID_NEW_TABLE_DESIGN appears in OApplicationController::GetState()
>> but only returns a setting:
>>
>>              case ID_NEW_TABLE_DESIGN:
>>              case ID_NEW_TABLE_DESIGN_AUTO_PILOT:
>>                  aReturn.bEnabled = !isDataSourceReadOnly() &&
>> !isConnectionReadOnly();
>>                  break;
>>
>> and appears again in OApplicationController::Execute(), in a large switch
>> statement's case block, that ultimately does:
>>
>>                      if ( bAutoPilot )
>>                          getContainer()->PostUserEvent( LINK( this,
>> OApplicationController, OnCreateWithPilot ), reinterpret_cast< void* >(
>> eType ) );
>>                      else
>>                      {
>>                          Reference< XComponent > xDocDefinition;
>>                          newElement( eType, aCreationArgs, xDocDefinition
>> );
>>                      }
>>
>> with bAutoPilot set to false, so it must be calling newElement(). We've
>> narrowed it down far enough, so we proceed with a debugger. Put a
>> breakpoint on OApplicationController::newElement(), and continue:
>>
>> (gdb) break dbaui::OApplicationController::newElement
>> Breakpoint 1 at 0x7fffcc4eb400: file
>> /AOO/main/dbaccess/source/ui/app/AppController.cxx,
>> line 1995.
>> (gdb) c
>>
>> Now open the dialog in AOO, and it will trigger the breakpoint:
>>
>> Thread 1 "soffice.bin" hit Breakpoint 1,
>> dbaui::OApplicationController::newElement
>> (this=this@entry=0x7fffd801e220, _eType=_eType@entry=dbaui::E_TABLE,
>> i_rAdditionalArguments=..., o_rDocumentDefinition=...)
>>      at /AOO/main/dbaccess/source/ui/app/AppController.cxx:1995
>> 1995    {
>> (gdb)
>>
>> Step through with "n", and then stepping into with "s" on line 2024:
>>
>> 2015        case E_TABLE:
>> 2016        {
>> 2017            ::std::auto_ptr< DatabaseObjectView > pDesigner;
>> 2018            SharedConnection xConnection( ensureConnection() );
>> 2019            if ( !xConnection.is() )
>> 2020                break;
>> 2021
>> 2022            if ( _eType == E_TABLE )
>> 2023            {
>> 2024                pDesigner.reset( new TableDesigner( getORB(), this,
>> getFrame() ) );
>> 2025            }
>>
>> I didn't have much luck stepping into line 2024, but did look for this
>> TableDesigner:
>>
>> [main/dbaccess]$ grep TableDesigner * -R
>> source/ui/misc/databaseobjectview.cxx:    //= TableDesigner
>> source/ui/misc/databaseobjectview.cxx:    TableDesigner::TableDesigner(
>> const Reference< XMultiServiceFactory >& _rxORB, const Reference<
>> XDatabaseDocumentUI >& _rxApplication, const Reference< XFrame >&
>> _rxParentFrame )
>> source/ui/misc/databaseobjectview.cxx:    void
>> TableDesigner::fillDispatchArgs( ::comphelper::NamedValueCollection&
>> i_rDispatchArgs, const Any& _aDataSource,
>> source/ui/misc/databaseobjectview.cxx:    Reference< XComponent >
>> TableDesigner::doCreateView( const Any& _rDataSource, const
>> ::rtl::OUString& _rObjectName,
>> source/ui/misc/databaseobjectview.cxx:        OSL_ENSURE(
>> xDesignerComponent.is(), "TableDesigner::doCreateView: a designer which is
>> no dialog and no component?" );
>> source/ui/misc/databaseobjectview.cxx:    Reference< XInterface >
>> TableDesigner::impl_getConnectionProvidedDesigner_nothrow( const
>> ::rtl::OUString& _rTableName )
>> source/ui/app/AppController.cxx:                        pDesigner.reset(
>> new TableDesigner( getORB(), this, m_aCurrentFrame.getFrame() ) );
>> source/ui/app/AppController.cxx:                pDesigner.reset( new
>> TableDesigner( getORB(), this, getFrame() ) );
>> source/ui/inc/databaseobjectview.hxx:    //= TableDesigner
>> source/ui/inc/databaseobjectview.hxx:    class TableDesigner : public
>> DatabaseObjectView
>> source/ui/inc/databaseobjectview.hxx:        TableDesigner(
>>
>> and in source/ui/misc/databaseobjectview.cxx we see it does very little:
>>      TableDesigner::TableDesigner( const Reference< XMultiServiceFactory
>> >&
>> _rxORB, const Reference< XDatabaseDocumentUI >& _rxApplication, const
>> Reference< XFrame >& _rxParentFrame )
>>          :DatabaseObjectView( _rxORB, _rxApplication, _rxParentFrame,
>> static_cast< ::rtl::OUString >( URL_COMPONENT_TABLEDESIGN ) )
>>      {
>>      }
>>
>> Further on in OApplicationController::newElement() then:
>>
>> 2032            xComponent.set( pDesigner->createNew( xDataSource,
>> i_rAdditionalArguments ), UNO_QUERY );
>>
>> Stepping into it, reading more code, etc. I eventually found a  useful
>> function, DatabaseObjectView::doDispatch() in
>> source/ui/misc/databaseobjectv
>> iew.cxx.
>>
>> Putting a breakpoint on it, we see this stack trace when it's hit:
>>
>> Thread 1 "soffice.bin" hit Breakpoint 2, dbaui::DatabaseObjectView::doD
>> ispatch
>> (this=this@entry=0x7fffade11c58, i_rDispatchArgs=...) at
>> /AOO/main/dbaccess/source/ui/misc/databaseobjectview.cxx:120
>> 120        {
>> (gdb) bt
>> #0  dbaui::DatabaseObjectView::doDispatch (this=this@entry=0x7fffade11c5
>> 8,
>> i_rDispatchArgs=...) at /AOO/main/dbaccess/source/ui/m
>> isc/databaseobjectview.cxx:120
>> #1  0x00007fffcc63543c in dbaui::DatabaseObjectView::doCreateView
>> (this=this@entry=0x7fffade11c58, _rDataSource=..., _rObjectName=...,
>> i_rCreationArgs=...) at /AOO/main/dbaccess/source/ui/m
>> isc/databaseobjectview.cxx:115
>> #2  0x00007fffcc635513 in dbaui::TableDesigner::doCreateView
>> (this=this@entry=0x7fffade11c58, _rDataSource=..., _rObjectName=...,
>> i_rCreationArgs=...) at /AOO/main/dbaccess/source/ui/m
>> isc/databaseobjectview.cxx:258
>> #3  0x00007fffcc634785 in dbaui::DatabaseObjectView::createNew
>> (this=0x7fffade11c58, _xDataSource=..., i_rDispatchArgs=...) at
>> /AOO/main/dbaccess/source/ui/misc/databaseobjectview.cxx:95
>> #4  0x00007fffcc4eb65b in dbaui::OApplicationController::newElement
>> (this=this@entry=0x7fffd801e220, _eType=_eType@entry=dbaui::E_TABLE,
>> i_rAdditionalArguments=..., o_rDocumentDefinition=...)
>>      at /AOO/main/dbaccess/source/ui/app/AppController.cxx:2032
>> #5  0x00007fffcc4f92cb in dbaui::OApplicationController::Execute
>> (this=0x7fffd801e220, _nId=<optimized out>, aArgs=...) at
>> /AOO/main/dbaccess/source/ui/app/AppController.cxx:1278
>> #6  0x00007fffcc54fa15 in dbaui::OGenericUnoController::executeChecked
>> (this=0x7fffd801e220, _rCommand=..., aArgs=...) at
>> /AOO/main/dbaccess/source/ui/browser/genericcontroller.cxx:1270
>> #7  0x00007fffcc517324 in dbaui::OCreationList::onSelected
>> (this=<optimized
>> out>, _pEntry=<optimized out>) at /AOO/main/dbaccess/source/ui/a
>> pp/AppDetailView.cxx:364
>> #8  0x00007ffff31015ca in ImplHandleMouseEvent (pWindow=pWindow@entry
>> =0x7fffd9c8f320, nSVEvent=nSVEvent@entry=2, bMouseLeave=bMouseLeave@entry
>> =0
>> '\000', nX=<optimized out>, nY=<optimized out>, nMsgTime=<optimized out>,
>> nCode=1, nMode=<optimized out>)
>>      at /AOO/main/vcl/source/window/winproc.cxx:813
>> #9  0x00007ffff310250d in ImplHandleSalMouseButtonUp
>> (pWindow=pWindow@entry
>> =0x7fffd9c8f320, pEvent=<optimized out>) at /AOO/main/vcl/source/window/wi
>> nproc.cxx:2086
>> #10 0x00007ffff3101f00 in ImplWindowFrameProc (pWindow=0x7fffd9c8f320,
>> nEvent=<optimized out>, pEvent=0x7fffffffade8) at
>> /AOO/main/vcl/source/window/winproc.cxx:2428
>> #11 0x00007fffebd07ae8 in GtkSalFrame::signalButton (pEvent=0x9974f0,
>> frame=0x7fffd8f81c88) at /AOO/main/vcl/unx/gtk/window/gtkframe.cxx:2678
>> #12 0x00007fffea9dbaec in ?? () from /usr/lib/x86_64-linux-gnu/libg
>> tk-x11-2.0.so.0
>> #13 0x00007fffeb214fa5 in g_closure_invoke () from
>> /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
>> #14 0x00007fffeb226fc1 in ?? () from /usr/lib/x86_64-linux-gnu/libg
>> object-2.0.so.0
>> #15 0x00007fffeb22f7f9 in g_signal_emit_valist () from
>> /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
>> #16 0x00007fffeb23008f in g_signal_emit () from
>> /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
>> #17 0x00007fffeaaf393c in ?? () from /usr/lib/x86_64-linux-gnu/libg
>> tk-x11-2.0.so.0
>> #18 0x00007fffea9da284 in gtk_propagate_event () from
>> /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
>> #19 0x00007fffea9da63b in gtk_main_do_event () from
>> /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
>> #20 0x00007fffea64ec8c in ?? () from /usr/lib/x86_64-linux-gnu/libg
>> dk-x11-2.0.so.0
>> #21 0x00007fffeaf3e197 in g_main_context_dispatch () from
>> /lib/x86_64-linux-gnu/libglib-2.0.so.0
>> #22 0x00007fffeaf3e3f0 in ?? () from /lib/x86_64-linux-gnu/libglib-
>> 2.0.so.0
>> #23 0x00007fffeaf3e49c in g_main_context_iteration () from
>> /lib/x86_64-linux-gnu/libglib-2.0.so.0
>> #24 0x00007fffebcf0592 in GtkXLib::Yield (this=0x7ffff7f77010,
>> bWait=<optimized out>, bHandleAllCurrentEvents=<optimized out>) at
>> /AOO/main/vcl/unx/gtk/app/gtkdata.cxx:874
>> #25 0x00007ffff2eaa8eb in ImplYield (i_bWait=i_bWait@entry=true,
>> i_bAllEvents=i_bAllEvents@entry=false) at /AOO/main/vcl/source/app/svapp
>> .cxx:476
>> #26 0x00007ffff2ea794c in Application::Yield
>> (i_bAllEvents=i_bAllEvents@entry=false)
>> at /AOO/main/vcl/source/app/svapp.cxx:510
>> #27 0x00007ffff2ea7971 in Application::Execute () at
>> /AOO/main/vcl/source/app/svapp.cxx:453
>> #28 0x00007ffff77140ff in desktop::Desktop::Main (this=0x7fffffffba40) at
>> /AOO/main/desktop/source/app/app.cxx:2232
>> #29 0x00007ffff2eae952 in ImplSVMain () at /AOO/main/vcl/source/app/svmai
>> n.cxx:196
>> #30 0x00007ffff2eaea59 in SVMain () at /AOO/main/vcl/source/app/svmai
>> n.cxx:237
>> #31 0x00007ffff774a2db in soffice_main () at
>> /AOO/main/desktop/source/app/s
>> officemain.cxx:45
>> #32 0x0000000000401266 in sal_main () at main.c:31
>> #33 0x000000000040124b in main (argc=1, argv=0x7fffffffbbd8) at main.c:30
>>
>> We also see an ugly catch statement there that swallows all exceptions,
>> which is why failure to open that dialog is silently ignored:
>>
>>              catch( const Exception& )
>>              {
>>                  DBG_UNHANDLED_EXCEPTION();
>>              }
>>
>> Maybe if you built Base in debug mode, you'd have more feedback from that
>> DBG_UNHANDLED_EXCEPTION?
>>
>> Anyway on line 155 is where we actually start doing something useful,
>> which
>> is loading m_sComponentURL (= ".component:DB/TableDesign") into target
>> frame "_self":
>>
>> 155                xReturn = xFrameLoader->loadComponentFromURL(
>> 156                    m_sComponentURL,
>> 157                    ::rtl::OUString(RTL_CONSTASCII
>> _USTRINGPARAM("_self")),
>> 158                    0,
>> 159                    i_rDispatchArgs.getPropertyValues()
>> 160                );
>>
>> My attempts to step deeper in aren't going well so I am taking a break.
>> Please try analyze how far you get in DatabaseObjectView::doDispatch() in
>> /main/dbaccess/source/ui/misc/databaseobjectview.cxx, and let me know?
>>
>> Happy debugging
>> Damjan
>>
>>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscr...@openoffice.apache.org
> For additional commands, e-mail: dev-h...@openoffice.apache.org
>
>

Reply via email to