Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[GTK3/GTKMM3] libcairo-2.dll call to DWrite.dll causing Segmentation fault #15316

Closed
2 of 7 tasks
giuspen opened this issue Jan 28, 2023 · 6 comments · Fixed by #15360
Closed
2 of 7 tasks

[GTK3/GTKMM3] libcairo-2.dll call to DWrite.dll causing Segmentation fault #15316

giuspen opened this issue Jan 28, 2023 · 6 comments · Fixed by #15360
Labels
bug reported-upstream Issues reported or fixed in upstream repository

Comments

@giuspen
Copy link
Contributor

giuspen commented Jan 28, 2023

Description / Steps to reproduce the issue

I have a crash when printing ( giuspen/cherrytree#2066 ) which as the backtrace below shows is pointing the finger to libcairo-2.dll calling DWrite.dll:

Thread 1 received signal SIGSEGV, Segmentation fault.
0x00007ffae80b5714 in ?? () from C:\Windows\SYSTEM32\DWrite.dll
(gdb) bt
#0  0x00007ffae80b5714 in ?? () from C:\Windows\SYSTEM32\DWrite.dll
#1  0x00007ffab8371f4c in ?? () from C:\msys64\mingw64\bin\libcairo-2.dll

I suspect this was introduced when re-enabling DWite in 853c407#diff-ec73b1797eaafa14b354022f28487d6a4d8f5e84ca776012c1c7fcdf6088b392
I tried to rebuild the package with the patch reverted ( following https://www.msys2.org/wiki/Creating-Packages/ ) but after installing, my app fails to link, I guess I have to rebuild all the libraries that depend on it. I wonder if there is an easy way or I have to rebuild all libraries manually.

Unfortunately for me gtk3-demo doesn't crash.

In case you would be happy to reproduce the crash via my app see https://github.com/giuspen/cherrytree#building-cherrytree-on-windows

PenoneG@KUKMW115 MINGW64 ~/git/cherrytree
# gdb ./build/cherrytree.exe
GNU gdb (GDB) 12.1
...
Reading symbols from ./build/cherrytree.exe...
(gdb) r
Starting program: C:\msys64\home\PenoneG\git\cherrytree\build\cherrytree.exe
[New Thread 9180.0x2540]
...
warning: mincore\com\oleaut32\dispatch\ups.cpp(2122)\OLEAUT32.dll!00007FFAFDD39DD6: (caller: 00007FFAFDD391E9) ReturnHr(1) tid
(477c) 8002801D Library not registered.
[New Thread 9180.0x5c30]
[Thread 9180.0x5c30 exited with code 0]
[New Thread 9180.0x5568]
[New Thread 9180.0x5320]
[Thread 9180.0x5568 exited with code 0]
warning: onecore\com\combase\registrationstore\registrationstore.cpp(7759)\combase.dll!00007FFAFD901F64: (caller: 00007FFAFD99
5B43) ReturnHr(1) tid(a88) 80070002 The system cannot find the file specified.
warning: onecore\com\combase\registrationstore\registrationstore.cpp(7759)\combase.dll!00007FFAFD901F64: (caller: 00007FFAFD99
5B43) ReturnHr(2) tid(a88) 80070002 The system cannot find the file specified.
warning: onecore\com\combase\registrationstore\registrationstore.cpp(7759)\combase.dll!00007FFAFD901F64: (caller: 00007FFAFD99
5B43) ReturnHr(3) tid(a88) 80070002 The system cannot find the file specified.
[Thread 9180.0x5320 exited with code 0]
warning: onecore\com\combase\registrationstore\registrationstore.cpp(7759)\combase.dll!00007FFAFD901F64: (caller: 00007FFAFD99
5B43) ReturnHr(4) tid(a88) 80070002 The system cannot find the file specified.
warning: onecore\com\combase\registrationstore\registrationstore.cpp(7759)\combase.dll!00007FFAFD901F64: (caller: 00007FFAFD99
5B43) ReturnHr(5) tid(a88) 80070002 The system cannot find the file specified.
warning: onecore\com\combase\registrationstore\registrationstore.cpp(7759)\combase.dll!00007FFAFD901F64: (caller: 00007FFAFD99
5B43) ReturnHr(6) tid(a88) 80070002 The system cannot find the file specified.
warning: com\ole32\oleregistrationenumeration\oleregistrationenumeration.cpp(150)\ole32.dll!00007FFAFE0387C3: (caller: 00007FF
AFE01B23E) LogHr(1) tid(a88) 80070057 The parameter is incorrect.
warning: com\ole32\oleregistrationenumeration\oleregistrationenumeration.cpp(150)\ole32.dll!00007FFAFE0387C3: (caller: 00007FF
AFE01B23E) LogHr(2) tid(a88) 80070057 The parameter is incorrect.
warning: com\ole32\oleregistrationenumeration\oleregistrationenumeration.cpp(150)\ole32.dll!00007FFAFE0387C3: (caller: 00007FF
AFE01B23E) LogHr(3) tid(a88) 80070057 The parameter is incorrect.
[New Thread 9180.0x601c]
warning: onecore\com\combase\dcomrem\security.cxx(3071)\combase.dll!00007FFAFD86BF3C: (caller: 00007FFAAE29823E) ReturnHr(7) t
id(601c) 80010117 Call context cannot be accessed after call completed.
warning: com\ole32\oleregistrationenumeration\oleregistrationenumeration.cpp(150)\ole32.dll!00007FFAFE0387C3: (caller: 00007FF
AFE01B23E) LogHr(4) tid(a88) 80070057 The parameter is incorrect.
[New Thread 9180.0x3140]

[Thread 9180.0x59c0 exited with code 0]
[New Thread 9180.0x3a40]
warning: Rejecting native image because native image dependency C:\Windows\Microsoft.Net\assembly\GAC_64\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll had a different identity than expe
cted
warning:
warning: com\ole32\oleregistrationenumeration\oleregistrationenumeration.cpp(150)\ole32.dll!00007FFAFE0387C3: (caller: 00007FFAFE01B23E) LogHr(5) tid(a88) 80070057 The parameter is incorrect.
warning: com\ole32\oleregistrationenumeration\oleregistrationenumeration.cpp(150)\ole32.dll!00007FFAFE0387C3: (caller: 00007FFAFE01B23E) LogHr(6) tid(a88) 80070057 The parameter is incorrect.
[New Thread 9180.0x1fd4]
[Thread 9180.0x1fd4 exited with code 0]
[Thread 9180.0x4d84 exited with code 0]
warning: Invalid parameter passed to C runtime function.

Thread 1 received signal SIGSEGV, Segmentation fault.
0x00007ffae80b5714 in ?? () from C:\Windows\SYSTEM32\DWrite.dll
(gdb) bt
#0  0x00007ffae80b5714 in ?? () from C:\Windows\SYSTEM32\DWrite.dll
#1  0x00007ffab8371f4c in ?? () from C:\msys64\mingw64\bin\libcairo-2.dll

Expected behavior

No crash

Actual behavior

warning: Invalid parameter passed to C runtime function.

Thread 1 received signal SIGSEGV, Segmentation fault.
0x00007ffae80b5714 in ?? () from C:\Windows\SYSTEM32\DWrite.dll
(gdb) bt
#0 0x00007ffae80b5714 in ?? () from C:\Windows\SYSTEM32\DWrite.dll
#1 0x00007ffab8371f4c in ?? () from C:\msys64\mingw64\bin\libcairo-2.dll

Verification

Windows Version

MINGW64_NT-10.0-19045

MINGW environments affected

  • MINGW64
  • MINGW32
  • UCRT64
  • CLANG64
  • CLANG32
  • CLANGARM64

Are you willing to submit a PR?

No response

@giuspen giuspen added the bug label Jan 28, 2023
@lazka
Copy link
Member

lazka commented Jan 28, 2023

The best way is probably to rebuild cairo with options=(debug !strip) (see https://wiki.archlinux.org/title/Debugging/Getting_traces#Compilation_options) and then get a stack trace with debug info.

And after that file a bug here: https://gitlab.freedesktop.org/cairo/cairo/-/issues

@Biswa96
Copy link
Member

Biswa96 commented Jan 28, 2023

@giuspen Thanks for reporting this issue. I have built the program in mingw64. Is it possible to reproduce the segfault stage without a printer? I am interested to debug the program but I do not have any printer.

@asctime
Copy link
Contributor

asctime commented Jan 28, 2023

@giuspen also another suggestion: MinGW inkscape package makes heavy use of CAIRO for printing. You might want to d/l the binary, draw and print something, to initially sort if its is code, environment or library specific. Also the source code is a textbook example of Windows printing using CAIRO. might be worth a look.

@giuspen
Copy link
Contributor Author

giuspen commented Jan 28, 2023

@Biswa96 yes just File--Print and then when you get the dialog select "Microsoft Print to PDF"
image
Click Print, it will then ask you for a place where to save the pdf and then crash once you click save

@giuspen
Copy link
Contributor Author

giuspen commented Jan 28, 2023

Thanks @lazka I have a better stack trace now, I will raise an issue where you indicated

warning: Invalid parameter passed to C runtime function.

Thread 1 received signal SIGSEGV, Segmentation fault.
0x00007ffae80b5714 in ?? () from C:\Windows\SYSTEM32\DWrite.dll
(gdb) bt
#0  0x00007ffae80b5714 in ?? () from C:\Windows\SYSTEM32\DWrite.dll
#1  0x00007ffab1f4cbdd in _cairo_dwrite_scaled_font_create_win32_scaled_font (scaled_font=scaled_font@entry=0x195c50310a0, new_font=new_font@entry=0x343cbfd870)
    at ../cairo-1.17.6/src/win32/cairo-dwrite-font.cpp:1721
#2  0x00007ffab1f4696c in _cairo_win32_printing_surface_show_glyphs (abstract_surface=0x195c30b14b0, op=CAIRO_OPERATOR_OVER, source=0x195c4e8c4a0, glyphs=0x343cbfdf50, num_glyphs=3,
    scaled_font=0x195c50310a0, clip=0x0) at ../cairo-1.17.6/src/win32/cairo-win32-printing-surface.c:1919
#3  0x00007ffab1f16cbf in _cairo_surface_show_text_glyphs (surface=0x195c30b14b0, op=op@entry=CAIRO_OPERATOR_OVER, source=source@entry=0x195c50e4748, utf8=utf8@entry=0x0,
    utf8_len=<optimized out>, utf8_len@entry=0, glyphs=glyphs@entry=0x343cbfdf50, num_glyphs=<optimized out>, num_glyphs@entry=3, clusters=clusters@entry=0x0, num_clusters=<optimized out>,
    num_clusters@entry=0, cluster_flags=cluster_flags@entry=0, scaled_font=scaled_font@entry=0x195c50310a0, clip=clip@entry=0x0) at ../cairo-1.17.6/src/cairo-surface.c:2920
#4  0x00007ffab1f13d59 in _cairo_surface_wrapper_show_text_glyphs (wrapper=wrapper@entry=0x343cbfe850, op=CAIRO_OPERATOR_OVER, source=source@entry=0x195c50e4748, utf8=0x0, utf8_len=0,
    glyphs=0x195c311efb0, num_glyphs=3, clusters=0x0, num_clusters=0, cluster_flags=0, scaled_font=0x195c50310a0, clip=0x0) at ../cairo-1.17.6/src/cairo-surface-wrapper.c:509
#5  0x00007ffab1f032f6 in _cairo_recording_surface_replay_internal (surface=0x195bd5df500, params=params@entry=0x343cbfe930) at ../cairo-1.17.6/src/cairo-recording-surface.c:1975
#6  0x00007ffab1f038d2 in _cairo_recording_surface_replay_region (surface=<optimized out>, surface_extents=surface_extents@entry=0x0, target=<optimized out>,
    region=region@entry=CAIRO_RECORDING_REGION_NATIVE) at ../cairo-1.17.6/src/cairo-recording-surface.c:2235
#7  0x00007ffab1eea261 in _paint_page (surface=surface@entry=0x195c31498d0) at ../cairo-1.17.6/src/cairo-paginated-surface.c:469
#8  0x00007ffab1eea557 in _cairo_paginated_surface_show_page (abstract_surface=0x195c31498d0) at ../cairo-1.17.6/src/cairo-paginated-surface.c:583
#9  0x00007ffab1f16861 in cairo_surface_show_page (surface=0x195c31498d0) at ../cairo-1.17.6/src/cairo-surface.c:2506
#10 0x00007ffaaef094f9 in ?? () from C:\msys64\mingw64\bin\libgtk-3-0.dll
#11 0x00007ffaaedd8c27 in ?? () from C:\msys64\mingw64\bin\libgtk-3-0.dll
#12 0x00007ffaaedd94d3 in ?? () from C:\msys64\mingw64\bin\libgtk-3-0.dll
#13 0x00007ffab8133080 in ?? () from C:\msys64\mingw64\bin\libgdk-3-0.dll
#14 0x00007ffab43e9f31 in ?? () from C:\msys64\mingw64\bin\libglib-2.0-0.dll
#15 0x00007ffab43ed328 in ?? () from C:\msys64\mingw64\bin\libglib-2.0-0.dll
#16 0x00007ffab43ed7f0 in ?? () from C:\msys64\mingw64\bin\libglib-2.0-0.dll
#17 0x00007ffaaedd9de9 in ?? () from C:\msys64\mingw64\bin\libgtk-3-0.dll
#18 0x00007ffaafd03fbe in ?? () from C:\msys64\mingw64\bin\libgtkmm-3.0-1.dll
#19 0x00007ff6d8d9e142 in CtPrint::print_text(fs::path const&, std::vector<std::shared_ptr<CtPangoObject>, std::allocator<std::shared_ptr<CtPangoObject> > > const&) ()
#20 0x00007ff6d8d9e889 in CtExport2Pdf::node_export_print(fs::path const&, CtTreeIter, CtExportOptions const&, int, int) ()
#21 0x00007ff6d8cab73e in CtActions::_export_print(bool, fs::path const&, bool) ()
#22 0x00007ff6d8cac1bd in CtActions::export_print() ()
#23 0x00007ffad3207a9d in ?? () from C:\msys64\mingw64\bin\libglibmm-2.4-1.dll
#24 0x00007ffab43e9f31 in ?? () from C:\msys64\mingw64\bin\libglib-2.0-0.dll
#25 0x00007ffab43ed328 in ?? () from C:\msys64\mingw64\bin\libglib-2.0-0.dll
#26 0x00007ffab43ed62d in ?? () from C:\msys64\mingw64\bin\libglib-2.0-0.dll
#27 0x00007ffab7e74f2d in ?? () from C:\msys64\mingw64\bin\libgio-2.0-0.dll
#28 0x00007ff6d8fc18b3 in main ()
(gdb)

@giuspen
Copy link
Contributor Author

giuspen commented Jan 28, 2023

Issue created against cairo: https://gitlab.freedesktop.org/cairo/cairo/-/issues/632

giuspen added a commit to giuspen/MINGW-packages that referenced this issue Jan 29, 2023
giuspen added a commit to giuspen/MINGW-packages that referenced this issue Jan 29, 2023
lazka added a commit that referenced this issue Jan 30, 2023
@Biswa96 Biswa96 added the reported-upstream Issues reported or fixed in upstream repository label Jan 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug reported-upstream Issues reported or fixed in upstream repository
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants