Skip to content
This repository has been archived by the owner on Jan 7, 2023. It is now read-only.

Reference counting assertion m_p failed #21

Closed
mohsenti opened this issue Sep 3, 2017 · 13 comments
Closed

Reference counting assertion m_p failed #21

mohsenti opened this issue Sep 3, 2017 · 13 comments

Comments

@mohsenti
Copy link

mohsenti commented Sep 3, 2017

Hi,

I build fastuidraw in Linux (Manjaro) and all build processes finished successful but when running demos, all of them failed and write below message to terminal output.

inc/fastuidraw/util/reference_counted.hpp:194: Assertion 'm_p' failed
Aborted (core dumped)

@krogueintel
Copy link
Contributor

Hi,

I have not been able to replicate this issue at all. I have tried on the following platforms:

  • Linux Mint 17.somthing
  • Linux Mint 18.0
  • Ubuntu 16.04
  • MS-Windows 10 with Msys2/Mingw64

At this point, I need a stack trace atleast. Right now, my only hunch is that the demos are trying to open a font from a file, and the path it had selected is not correct for Manjaro. However, a number of demos do not try to open a font (for example gradient-test and image-test). Do those two demos also die the same way?

@mohsenti
Copy link
Author

mohsenti commented Sep 5, 2017

Gradient-test work fine but image-test open black window and doesn't draw anything.

@krogueintel
Copy link
Contributor

krogueintel commented Sep 5, 2017

Hi,

At this point, I need the following data:

What is the behavior of each demo on debug, this includes the following:

  • if there are any GL error emitted to stderr (debug builds will print to stderr whenever GL emits an error)
  • if after a demo runs a file of the from bad_shader.glsl.X or bad_program.glsl.X is made; these files are made whenever the GL driver cannot compile a glsl shader or link a glsl program. Don't forget to delete these files after running each demo
  • if a demo crashes (with an assert failure), I need a stack trace

Lastly, I need to know what is the GL hardware and driver used in your device. The requirements for the hardware are stated in the readme.

One more thing: make sure that the demos are using the .so's that they were built with, i.e. use ldd to check. I've had a situation where a user installed FastUIDraw to their system (typically to /usr/local) and a new version of FastUIDraw as not ABI compatible and the demos used the older .so's when run but where compiled with a new version. There is a make uninstall target, but it requires to know the path (by setting INSTALL_LOCATION) to know where to remove the files.

@krogueintel
Copy link
Contributor

One more thing, the default for image-test is to use a very, very small image. Run image-test as follows to have it draw large (and ugly) programmer art:

./image-test-GL-debug add_image demo_data/images/1024x1024.png

One can also substitute other images as one sees fit.

Also, make sure your system has SDL2_image in such a way that it can read most image formats (usually this means just making sure that libpeg, libpng are installed as well).

@mohsenti
Copy link
Author

mohsenti commented Sep 6, 2017

Hi,

./image-test-GL-debug add_image demo_data/images/1024x1024.png command wok without error.

For example I run " ./painter-cells-GL-debug" and application crash and it write below strings to terminal.

Running: "./painter-cells-GL-debug
Glyph Geometry Store: auto selected buffer
inc/fastuidraw/util/reference_counted.hpp:194: Assertion 'm_p' failed
Aborted (core dumped)

I can't find bad_shader.glsl.X or bad_program.glsl.X files in directories.

How can i get stacktrace ?

GL Hardware : ATI Radeon 4000
Driver : Mesa , OpenGL 3

One more thing: make sure that the demos are using the .so's that they were built with, i.e. use ldd to check. I've had a situation where a user installed FastUIDraw to their system (typically to /usr/local) and a new version of FastUIDraw as not ABI compatible and the demos used the older .so's when run but where compiled with a new version. There is a make uninstall target, but it requires to know the path (by setting INSTALL_LOCATION) to know where to remove the files.

I'm sure, demos using correct .so libraries.

Also, make sure your system has SDL2_image in such a way that it can read most image formats (usually this means just making sure that libpeg, libpng are installed as well).

SDL is fully installed on my OS.

@krogueintel
Copy link
Contributor

To get a stack trace, just launch the program from gdb:

gdb ./painter-cells-GL-debug

Before checking out painter-cells, it is prudent try out simpler demos. The demos to try in increasing order of complexity are:

  1. gradient-test
  2. image-test
  3. glyph-test
  4. painter-test (*)
  5. painter-cliprect-test
  6. painter-clippath-test
  7. painter-path-test
  8. painter-glyph-test
  9. painter-cells

One should view the results of 1, 2, 3, 4 as orthogonal (they test different things). The painter-test does not draw anything to the screen, it merely tries to compile the shaders for the fastuidraw painter.

Can you output the output of glxinfo please? ATI Radeon 4000 is quite ancient card (at 9 years old since release). If the GL version is 3.3 it should work, but I have not had the opportunity to use older ATI/AMD GPU's.

@mohsenti
Copy link
Author

mohsenti commented Sep 6, 2017

I run samples in your order. 1 , 2 work great but when running 3, reference counting assertion occur.
bt.txt

and glxinfo output.
glxInfo.txt

painter-cells
bt2.txt

other examples work fine.

@krogueintel
Copy link
Contributor

krogueintel commented Sep 6, 2017

Hi,

The issue is that demos are making a bad guess where fonts are located (or for that matter a good default font). However, each of the demos has an option to specify a font file; those that do font selection from a "font description" also have an option to set the path. The options are as follows:

  1. For glyph-test, painter-cells and painter-path-test, the file to use for a font can be set by specifying the command line option "font". For example, running "./glyph-test-GL-debug font /some/path/font.ttf" will use the font in the file /some/path/font.ttf.

  2. For painter-glyph-test, you can have it select a font from fonts in a path or you can tell it to load the font to use from a specific file.

  • Use the command line option "font_file" to specify and exact file to use for the font, for example "./painter-glyph-test-GL-debug font_file /some/path/font.ttf" will use the font in the file /some/path/font.ttf" will direct it to use the font in the file /some/path/font.ttf.
  • If you wish for it to use font-selection, then you need to specify the path where the system fonts are located using the option "font_path"; for example "./painter-glyph-test-GL-debug font_path /some/path/fonts/" will tell it to look for fonts (path-recursively) in the path /some/path/fonts/

As always, use "-help" on any demo to see more details.

I should add error checking for font loading though so that rather than asserting out, the demo would simple not try to draw letters.

@krogueintel
Copy link
Contributor

krogueintel commented Sep 6, 2017

I've push a pair of commits that should stop the crashes. The commits to:

  1. libFastUIDraw.so: in FontFreeType to have code to handle if passed face generator is unable to produce faces
  2. Error messages in the demos that draw text if they are unable to load fonts.

Thank you for the bug report (though it would have been nicer if the start of the bug was more precise in naming what demos crashed).

Please let me know if these stop your crashes.

Maybe later, I will try to add to the demos to query the system where the fonts are located rather than relying on the values in Ubuntu based distros.

@krogueintel
Copy link
Contributor

Please let me know if the issue is solved so that the issue can be closed.

@krogueintel
Copy link
Contributor

By the way, according to the glxInfo.txt, the GPU in use is NOT an AMD Radeon 4000, but your integrated Sandy Bridge GPU.

@mohsenti
Copy link
Author

mohsenti commented Sep 7, 2017

Please let me know if the issue is solved so that the issue can be closed.

Hi,
I pull latest repository changes and rebuilds library and demos, all errors goes away and all demos works perfect.

@krogueintel
Copy link
Contributor

Excellent, issue now closed.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants