Created attachment 161737 [details] patch for dialog_remove_buttons, open/save dialog crashes LibreOffice crashes when one wants to open/save a file. FreeBSD 10.2 stable libreoffice-5.0.2 (from ports at revision r397871) gtk3-3.16.6 glib-2.44.1_1 Similar problem is mentioned here: https://bugs.pcbsd.org/issues/11518 I have recompiled LibreOffice and GTK3 with debug info and got: $ lowriter --backtrace $ cat gdbtrace.log (no debugging symbols found)...(no debugging symbols found)...(no debugging symbols found)...(no debugging symbols found)...[New LWP 100207] (no debugging symbols found)... [*** DELETED SOME NO DEBUGGINS SUMBOLS INFO ***] [New Thread 817c06400 (LWP 100207/soffice.bin)] [New Thread 817c07c00 (LWP 100675/soffice.bin)] Program received signal SIGSEGV, Segmentation fault. [Switching to Thread 817c06400 (LWP 100207/soffice.bin)] 0x0000000818208397 in gtk_container_foreach (container=0x0, callback=0x8182084a0 <gtk_container_children_callback>, callback_data=0x7fffffffacf0) at gtkcontainer.c:2327 2327 gtkcontainer.c: No such file or directory. in gtkcontainer.c Current language: auto; currently minimal #0 0x0000000818208397 in gtk_container_foreach (container=0x0, callback=0x8182084a0 <gtk_container_children_callback>, callback_data=0x7fffffffacf0) at gtkcontainer.c:2327 #1 0x000000081820848b in gtk_container_get_children (container=0x0) at gtkcontainer.c:2394 #2 0x0000000817578ffd in create_SalInstance () from /usr/local/lib/libreoffice/program/libvclplug_gtk3lo.so #3 0x0000000817576c6d in create_SalInstance () from /usr/local/lib/libreoffice/program/libvclplug_gtk3lo.so #4 0x00000008175767f0 in create_SalInstance () from /usr/local/lib/libreoffice/program/libvclplug_gtk3lo.so #5 0x0000000817576cbf in create_SalInstance () from /usr/local/lib/libreoffice/program/libvclplug_gtk3lo.so #6 0x000000080453ce6e in sfx2::FileDialogHelper::DialogClosed () from /usr/local/lib/libreoffice/program/libsfxlo.so #7 0x0000000804545f6f in sfx2::FileDialogHelper::FileDialogHelper () from /usr/local/lib/libreoffice/program/libsfxlo.so #8 0x0000000804547a9a in sfx2::FileDialogHelper::ControlStateChanged () from /usr/local/lib/libreoffice/program/libsfxlo.so #9 0x0000000804359c44 in SfxApplication::LoadTemplate () from /usr/local/lib/libreoffice/program/libsfxlo.so #10 0x000000080434c558 in SfxApplication::GetFilterMatcher () from /usr/local/lib/libreoffice/program/libsfxlo.so #11 0x0000000804466802 in SfxDispatcher::GetModule () from /usr/local/lib/libreoffice/program/libsfxlo.so #12 0x000000080445b932 in SfxDispatcher::IsAppDispatcher () from /usr/local/lib/libreoffice/program/libsfxlo.so #13 0x000000080446215f in SfxDispatcher::Execute () from /usr/local/lib/libreoffice/program/libsfxlo.so #14 0x000000080445c518 in SfxDispatcher::GetBindings () from /usr/local/lib/libreoffice/program/libsfxlo.so #15 0x0000000804362239 in SfxApplication::LoadTemplate () from /usr/local/lib/libreoffice/program/libsfxlo.so #16 0x000000080478ad4a in com_sun_star_comp_sfx2_GlobalEventBroadcaster_get_implementation () from /usr/local/lib/libreoffice/program/libsfxlo.so #17 0x000000080478ac7f in com_sun_star_comp_sfx2_GlobalEventBroadcaster_get_implementation () from /usr/local/lib/libreoffice/program/libsfxlo.so #18 0x000000080478ac2f in com_sun_star_comp_sfx2_GlobalEventBroadcaster_get_implementation () from /usr/local/lib/libreoffice/program/libsfxlo.so #19 0x000000080478abf8 in com_sun_star_comp_sfx2_GlobalEventBroadcaster_get_implementation () from /usr/local/lib/libreoffice/program/libsfxlo.so #20 0x0000000807197309 in Accelerator::operator= () from /usr/local/lib/libreoffice/program/libvcllo.so #21 0x000000080737f9af in vcl::Window::CompatPreNotify () from /usr/local/lib/libreoffice/program/libvcllo.so #22 0x000000080737d02a in vcl::Window::CompatPreNotify () from /usr/local/lib/libreoffice/program/libvcllo.so #23 0x00000008079354ef in SalGenericDisplay::HasUserEvents () from /usr/local/lib/libreoffice/program/libvcllo.so #24 0x000000080793406f in SalGenericDisplay::DispatchInternalEvent () from /usr/local/lib/libreoffice/program/libvcllo.so #25 0x0000000817547f53 in DeInitAtkBridge () from /usr/local/lib/libreoffice/program/libvclplug_gtk3lo.so #26 0x000000081754805e in DeInitAtkBridge () from /usr/local/lib/libreoffice/program/libvclplug_gtk3lo.so #27 0x000000080aabc5c8 in g_main_context_dispatch () from /usr/local/lib/libglib-2.0.so.0 #28 0x000000080aabc8fb in g_main_context_pending () from /usr/local/lib/libglib-2.0.so.0 #29 0x000000080aabc984 in g_main_context_iteration () from /usr/local/lib/libglib-2.0.so.0 #30 0x0000000817546bc2 in DeInitAtkBridge () from /usr/local/lib/libreoffice/program/libvclplug_gtk3lo.so #31 0x000000081754a417 in create_SalInstance () from /usr/local/lib/libreoffice/program/libvclplug_gtk3lo.so #32 0x0000000807861667 in Application::setDeInitHook () from /usr/local/lib/libreoffice/program/libvcllo.so #33 0x000000080785caf3 in Application::Yield () from /usr/local/lib/libreoffice/program/libvcllo.so #34 0x000000080785cabc in Application::Execute () from /usr/local/lib/libreoffice/program/libvcllo.so #35 0x0000000800ac7d32 in ?? () from /usr/local/lib/libreoffice/program/libsofficeapp.so #36 0x00000008078665d8 in VclResId () from /usr/local/lib/libreoffice/program/libvcllo.so #37 0x00000008078678eb in SVMain () from /usr/local/lib/libreoffice/program/libvcllo.so #38 0x0000000800b1a798 in soffice_main () from /usr/local/lib/libreoffice/program/libsofficeapp.so #39 0x000000000040089d in ?? () #40 0x0000000000400877 in ?? () #41 0x000000000040076f in ?? () #42 0x0000000800621000 in ?? () #43 0x0000000000000000 in ?? () [New Thread 82b841400 (LWP 100684/soffice.bin)] [New Thread 827383000 (LWP 100683/soffice.bin)] [New Thread 827382c00 (LWP 100682/soffice.bin)] [New Thread 820e7d800 (LWP 100680/soffice.bin)] [New Thread 81cabc400 (LWP 100677/soffice.bin)] [New Thread 817c08000 (LWP 100676/soffice.bin)] [New Thread 817c06800 (LWP 100674/soffice.bin)] Thread 10 (Thread 817c06800 (LWP 100674/soffice.bin)): #0 0x0000000801194dfc in pthread_cleanup_pop () from /lib/libthr.so.3 #1 0x00000008011932dc in _pthread_cond_wait () from /lib/libthr.so.3 #2 0x000000080083e8b6 in rtl_secureZeroMemory () from /usr/local/lib/libreoffice/program/libuno_sal.so.3 #3 0x000000080083e7ca in rtl_secureZeroMemory () from /usr/local/lib/libreoffice/program/libuno_sal.so.3 #4 0x0000000801189775 in pthread_create () from /lib/libthr.so.3 #5 0x0000000000000000 in ?? () Thread 9 (Thread 817c08000 (LWP 100676/soffice.bin)): #0 0x0000000800eaff8a in _accept () from /lib/libc.so.7 #1 0x000000080118b806 in pthread_suspend_all_np () from /lib/libthr.so.3 #2 0x000000080087cb92 in osl_acceptPipe () from /usr/local/lib/libreoffice/program/libuno_sal.so.3 #3 0x0000000800b177b7 in ResId::operator rtl::OUString () from /usr/local/lib/libreoffice/program/libsofficeapp.so #4 0x0000000800b12e3a in ResId::operator rtl::OUString () from /usr/local/lib/libreoffice/program/libsofficeapp.so #5 0x00000008039051d3 in salhelper::Thread::run () from /usr/local/lib/libreoffice/program/libuno_salhelpergcc3.so.3 #6 0x000000080390526c in non-virtual thunk to salhelper::Thread::run() () from /usr/local/lib/libreoffice/program/libuno_salhelpergcc3.so.3 #7 0x000000080390564e in non-virtual thunk to salhelper::Thread::onTerminated() () from /usr/local/lib/libreoffice/program/libuno_salhelpergcc3.so.3 #8 0x000000080088b0f8 in osl_setThreadTextEncoding () from /usr/local/lib/libreoffice/program/libuno_sal.so.3 #9 0x0000000801189775 in pthread_create () from /lib/libthr.so.3 #10 0x0000000000000000 in ?? () Thread 8 (Thread 81cabc400 (LWP 100677/soffice.bin)): #0 0x0000000800eafeaa in _poll () from /lib/libc.so.7 #1 0x000000080118bcd6 in pthread_suspend_all_np () from /lib/libthr.so.3 #2 0x000000080aabc8ad in g_main_context_pending () from /usr/local/lib/libglib-2.0.so.0 #3 0x000000080aabcc0f in g_main_loop_run () from /usr/local/lib/libglib-2.0.so.0 #4 0x000000081986bb5b in g_dbus_proxy_call_with_unix_fd_list_sync () from /usr/local/lib/libgio-2.0.so.0 #5 0x000000080aae282a in g_thread_unref () from /usr/local/lib/libglib-2.0.so.0 #6 0x0000000801189775 in pthread_create () from /lib/libthr.so.3 #7 0x0000000000000000 in ?? () Thread 7 (Thread 820e7d800 (LWP 100680/soffice.bin)): #0 0x0000000800efa09a in _kevent () from /lib/libc.so.7 #1 0x000000080118c272 in pthread_suspend_all_np () from /lib/libthr.so.3 #2 0x0000000819888e5f in g_local_file_monitor_get_type () from /usr/local/lib/libgio-2.0.so.0 #3 0x0000000801189775 in pthread_create () from /lib/libthr.so.3 #4 0x0000000000000000 in ?? () Thread 6 (Thread 827382c00 (LWP 100682/soffice.bin)): #0 0x0000000801194dfc in pthread_cleanup_pop () from /lib/libthr.so.3 #1 0x00000008011932dc in _pthread_cond_wait () from /lib/libthr.so.3 #2 0x000000080ab01d5f in g_cond_wait_until () from /usr/local/lib/libglib-2.0.so.0 #3 0x000000080aa8f2a8 in g_async_queue_pop () from /usr/local/lib/libglib-2.0.so.0 #4 0x000000080aae3820 in g_thread_pool_get_max_idle_time () from /usr/local/lib/libglib-2.0.so.0 #5 0x000000080aae282a in g_thread_unref () from /usr/local/lib/libglib-2.0.so.0 #6 0x0000000801189775 in pthread_create () from /lib/libthr.so.3 #7 0x0000000000000000 in ?? () Thread 5 (Thread 827383000 (LWP 100683/soffice.bin)): #0 0x0000000801194dfc in pthread_cleanup_pop () from /lib/libthr.so.3 #1 0x00000008011932dc in _pthread_cond_wait () from /lib/libthr.so.3 #2 0x000000080ab01d5f in g_cond_wait_until () from /usr/local/lib/libglib-2.0.so.0 #3 0x000000080aa8f2a8 in g_async_queue_pop () from /usr/local/lib/libglib-2.0.so.0 #4 0x000000080aae3820 in g_thread_pool_get_max_idle_time () from /usr/local/lib/libglib-2.0.so.0 #5 0x000000080aae282a in g_thread_unref () from /usr/local/lib/libglib-2.0.so.0 #6 0x0000000801189775 in pthread_create () from /lib/libthr.so.3 #7 0x0000000000000000 in ?? () Thread 4 (Thread 82b841400 (LWP 100684/soffice.bin)): #0 0x0000000800eafeaa in _poll () from /lib/libc.so.7 #1 0x000000080118bcd6 in pthread_suspend_all_np () from /lib/libthr.so.3 #2 0x000000080aabc8ad in g_main_context_pending () from /usr/local/lib/libglib-2.0.so.0 #3 0x000000080aabc984 in g_main_context_iteration () from /usr/local/lib/libglib-2.0.so.0 #4 0x000000080aabe196 in g_main_context_invoke_full () from /usr/local/lib/libglib-2.0.so.0 #5 0x000000080aae282a in g_thread_unref () from /usr/local/lib/libglib-2.0.so.0 #6 0x0000000801189775 in pthread_create () from /lib/libthr.so.3 #7 0x0000000000000000 in ?? () Thread 2 (Thread 817c06400 (LWP 100207/soffice.bin)): #0 0x0000000818208397 in gtk_container_foreach (container=0x0, callback=0x8182084a0 <gtk_container_children_callback>, callback_data=0x7fffffffacf0) at gtkcontainer.c:2327 #1 0x000000081820848b in gtk_container_get_children (container=0x0) at gtkcontainer.c:2394 #2 0x0000000817578ffd in create_SalInstance () from /usr/local/lib/libreoffice/program/libvclplug_gtk3lo.so #3 0x0000000817576c6d in create_SalInstance () from /usr/local/lib/libreoffice/program/libvclplug_gtk3lo.so #4 0x00000008175767f0 in create_SalInstance () from /usr/local/lib/libreoffice/program/libvclplug_gtk3lo.so #5 0x0000000817576cbf in create_SalInstance () from /usr/local/lib/libreoffice/program/libvclplug_gtk3lo.so #6 0x000000080453ce6e in sfx2::FileDialogHelper::DialogClosed () from /usr/local/lib/libreoffice/program/libsfxlo.so #7 0x0000000804545f6f in sfx2::FileDialogHelper::FileDialogHelper () from /usr/local/lib/libreoffice/program/libsfxlo.so #8 0x0000000804547a9a in sfx2::FileDialogHelper::ControlStateChanged () from /usr/local/lib/libreoffice/program/libsfxlo.so #9 0x0000000804359c44 in SfxApplication::LoadTemplate () from /usr/local/lib/libreoffice/program/libsfxlo.so #10 0x000000080434c558 in SfxApplication::GetFilterMatcher () from /usr/local/lib/libreoffice/program/libsfxlo.so #11 0x0000000804466802 in SfxDispatcher::GetModule () from /usr/local/lib/libreoffice/program/libsfxlo.so #12 0x000000080445b932 in SfxDispatcher::IsAppDispatcher () from /usr/local/lib/libreoffice/program/libsfxlo.so #13 0x000000080446215f in SfxDispatcher::Execute () from /usr/local/lib/libreoffice/program/libsfxlo.so #14 0x000000080445c518 in SfxDispatcher::GetBindings () from /usr/local/lib/libreoffice/program/libsfxlo.so #15 0x0000000804362239 in SfxApplication::LoadTemplate () from /usr/local/lib/libreoffice/program/libsfxlo.so #16 0x000000080478ad4a in com_sun_star_comp_sfx2_GlobalEventBroadcaster_get_implementation () from /usr/local/lib/libreoffice/program/libsfxlo.so #17 0x000000080478ac7f in com_sun_star_comp_sfx2_GlobalEventBroadcaster_get_implementation () from /usr/local/lib/libreoffice/program/libsfxlo.so #18 0x000000080478ac2f in com_sun_star_comp_sfx2_GlobalEventBroadcaster_get_implementation () from /usr/local/lib/libreoffice/program/libsfxlo.so #19 0x000000080478abf8 in com_sun_star_comp_sfx2_GlobalEventBroadcaster_get_implementation () from /usr/local/lib/libreoffice/program/libsfxlo.so #20 0x0000000807197309 in Accelerator::operator= () from /usr/local/lib/libreoffice/program/libvcllo.so #21 0x000000080737f9af in vcl::Window::CompatPreNotify () from /usr/local/lib/libreoffice/program/libvcllo.so #22 0x000000080737d02a in vcl::Window::CompatPreNotify () from /usr/local/lib/libreoffice/program/libvcllo.so #23 0x00000008079354ef in SalGenericDisplay::HasUserEvents () from /usr/local/lib/libreoffice/program/libvcllo.so #24 0x000000080793406f in SalGenericDisplay::DispatchInternalEvent () from /usr/local/lib/libreoffice/program/libvcllo.so #25 0x0000000817547f53 in DeInitAtkBridge () from /usr/local/lib/libreoffice/program/libvclplug_gtk3lo.so #26 0x000000081754805e in DeInitAtkBridge () from /usr/local/lib/libreoffice/program/libvclplug_gtk3lo.so #27 0x000000080aabc5c8 in g_main_context_dispatch () from /usr/local/lib/libglib-2.0.so.0 #28 0x000000080aabc8fb in g_main_context_pending () from /usr/local/lib/libglib-2.0.so.0 #29 0x000000080aabc984 in g_main_context_iteration () from /usr/local/lib/libglib-2.0.so.0 #30 0x0000000817546bc2 in DeInitAtkBridge () from /usr/local/lib/libreoffice/program/libvclplug_gtk3lo.so #31 0x000000081754a417 in create_SalInstance () from /usr/local/lib/libreoffice/program/libvclplug_gtk3lo.so #32 0x0000000807861667 in Application::setDeInitHook () from /usr/local/lib/libreoffice/program/libvcllo.so #33 0x000000080785caf3 in Application::Yield () from /usr/local/lib/libreoffice/program/libvcllo.so #34 0x000000080785cabc in Application::Execute () from /usr/local/lib/libreoffice/program/libvcllo.so #35 0x0000000800ac7d32 in ?? () from /usr/local/lib/libreoffice/program/libsofficeapp.so #36 0x00000008078665d8 in VclResId () from /usr/local/lib/libreoffice/program/libvcllo.so #37 0x00000008078678eb in SVMain () from /usr/local/lib/libreoffice/program/libvcllo.so #38 0x0000000800b1a798 in soffice_main () from /usr/local/lib/libreoffice/program/libsofficeapp.so #39 0x000000000040089d in ?? () #40 0x0000000000400877 in ?? () #41 0x000000000040076f in ?? () #42 0x0000000800621000 in ?? () #43 0x0000000000000000 in ?? () Interesting part is: #1 0x000000081820848b in gtk_container_get_children (container=0x0) at gtkcontainer.c:2394 gtk_container_get_children takes a null pointer as it first argument, it is used only once in dialog_remove_buttons function in vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx I have added some test whether a pointer returned by GTK_CONTAINER is null or not, patch below (also in the attachment): diff -ur work.orig/libreoffice-5.0.2.2/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx work/libreoffice-5.0.2.2/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx --- work.orig/libreoffice-5.0.2.2/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx 2015-10-05 19:19:56.189936000 +0200 +++ work/libreoffice-5.0.2.2/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx 2015-10-05 19:22:28.876627000 +0200 @@ -421,13 +421,18 @@ static void dialog_remove_buttons(GtkWidget *pActionArea) { - GList *pChildren = - gtk_container_get_children( GTK_CONTAINER( pActionArea ) ); + GtkContainer * container = GTK_CONTAINER( pActionArea ); - for( GList *p = pChildren; p; p = p->next ) - gtk_widget_destroy( GTK_WIDGET( p->data ) ); + if( container ) + { + GList *pChildren = + gtk_container_get_children( container ); + + for( GList *p = pChildren; p; p = p->next ) + gtk_widget_destroy( GTK_WIDGET( p->data ) ); - g_list_free( pChildren ); + g_list_free( pChildren ); + } } static void Now LibreOffice is able to show the open/save file dialog. By the way, LibreOffice didn't compile correctly -- there is a problem with one unit test, temporarily I have commented out this test: --- work/libreoffice-5.0.2.2/sc/qa/unit/ucalc.cxx.orig 2015-10-05 20:36:31.532112000 +0200 +++ work/libreoffice-5.0.2.2/sc/qa/unit/ucalc.cxx 2015-10-05 20:37:01.037140000 +0200 @@ -4534,10 +4534,11 @@ SfxUndoManager* pUndoMgr = m_pDoc->GetUndoManager(); CPPUNIT_ASSERT(pUndoMgr); pUndoMgr->Undo(); - + /* CPPUNIT_ASSERT_EQUAL(1.0, m_pDoc->GetValue(ScAddress(0,0,0))); for (SCROW i = 1; i <= 5; ++i) CPPUNIT_ASSERT(m_pDoc->GetCellType(ScAddress(0,i,0)) == CELLTYPE_NONE); + */ // Redo should put the serial values back in. pUndoMgr->Redo();
I want to confirm that the patch works. Thanks. -- Martin
Created attachment 164277 [details] patch: save-crashing: version as in 5.0.4.2 RC2 This is a patch generated from version 5.0.4.2-RC2 (thereby following the way the team of libreoffice has chosen) ready for the directory “editors/libreoffice/files/” working with the current version 5.0.3_1 in our ports. One should remark in the Makefile that this patch-file has to be removed when updating to 5.0.4.*! It should take another seven and a half hours until the compile in my poudriere(8) will be finished—in case someone wants to try this earlier: feel free to do so by using the new patch. (As the old patch is not deleted by the bug tracking system, I shall be so bold as to declare it superseded.) Regards, Kalten
(In reply to Kalten from comment #2) I am very sorry—the compile using the patch in attachment 164277 [details] (which happens to be c1b97d2747004d1912744ab7ff11353a73713310 in the git repository of libreoffice) did not solve the problem when using OPTIONS_FILE_UNSET+=GTK2 OPTIONS_FILE_SET+=GTK3 I shall retry with GTK2 instead of GTK3 and attachment 164277 [details]. My report shall follow in about eight hours. Regards, Kalten
(In reply to Kalten from comment #3) > I shall retry with GTK2 instead of GTK3 and attachment 164277 [details]. I am happy to report that this combination does work on 10.2-RELEASE-p7 (amd64). Regards, Kalten
Same here on CURRENT with most recent LibreOffice port (5.0.4). Also compiling with GTK3.
Could this patch be committed? I experience the same issue on my computers.
Please: is any additional testing required to progress this patch for the bug? Some discussion at https://forums.pcbsd.org/thread-20263.html
Created attachment 179545 [details] Fix for libreoffice-5.2.4_3 The attached patch fixes this crash for me in libreoffice-5.2.4_3. FreeBSD 11.0-RELEASE-p6
Created attachment 179547 [details] Another possible fix Can you please try this patch?
Jung-uk Kim the patch you posted did not fix the problem.
Created attachment 179729 [details] Yet another possible fix
(In reply to amistry from comment #10) Hmmm... Can you please try the new patch?
Created attachment 179731 [details] Fix GTK3 crash Please try this instead. Sorry.
The latest patch "Fix GTK3 crash" works and fixes the crash. Thank you.
A commit references this bug: Author: jkim Date: Wed Feb 8 18:44:55 UTC 2017 New revision: 433663 URL: https://svnweb.freebsd.org/changeset/ports/433663 Log: - Stop crashing when GTK3 GUI is enabled. - Always use gtk_dialog_get_action_area(). It was available since GTK 2.14. PR: 203563 Changes: head/editors/libreoffice/Makefile head/editors/libreoffice/files/patch-vcl_unx_gtk_fpicker_SalGtkFilePicker.cxx
Committed. Sorry it took so long.
A commit references this bug: Author: jkim Date: Fri Feb 10 02:02:55 UTC 2017 New revision: 433781 URL: https://svnweb.freebsd.org/changeset/ports/433781 Log: Refine r433663. If "use-header-bar" property of the dialog is set to TRUE, it uses a GtkHeaderBar for action buttons instead of the action area and gtk_dialog_get_header_bar() should not return NULL. If it is set to FALSE, gtk_dialog_get_header_bar() always returns NULL. In other words, we should not remove buttons from both header bar and action area in any case. This patch also removes pointless assertions from the previous patch. PR: 203563 Changes: head/editors/libreoffice/Makefile head/editors/libreoffice/files/patch-vcl_unx_gtk_fpicker_SalGtkFilePicker.cxx