<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>Segfault in al_show_native_file_dialog()</title>
		<link>http://www.allegro.cc/forums/view/618647</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Fri, 15 Apr 2022 05:40:55 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Hello,</p><p>I am losing my mind! I had a native file dialog working well, then I made some changes and broke it. Now, I cannot get it working again.</p><p>I followed the example: <a href="https://github.com/liballeg/allegro5/blob/e8457df9492158f2c5f41676e70f0b98c7f5deeb/examples/ex_native_filechooser.c#L101">ex_native_filechooser.c</a>, and had a pretty good system working before I screwed it up.</p><p>I&#39;m not sure if something is wrong with my development environment, because I&#39;m sure the below code should work. The below gives me a segfault, should it?</p><div class="source-code"><div class="toolbar"><span class="button numbers"><b>#</b></span><span class="button select">Select</span><span class="button expand">Expand</span></div><div class="inner"><span class="number">  1</span><span class="p">#include &lt;allegro5/allegro.h&gt;</span>
<span class="number">  2</span><span class="p">#include &lt;allegro5/allegro_native_dialog.h&gt;</span>
<span class="number">  3</span>
<span class="number">  4</span><span class="k1">int</span> main<span class="k2">(</span><span class="k2">)</span>
<span class="number">  5</span><span class="k2">{</span>
<span class="number">  6</span>    <a href="http://www.allegro.cc/manual/al_init"><span class="a">al_init</span></a><span class="k2">(</span><span class="k2">)</span><span class="k2">;</span>
<span class="number">  7</span>
<span class="number">  8</span>    <a href="http://www.allegro.cc/manual/ALLEGRO_DISPLAY"><span class="a">ALLEGRO_DISPLAY</span></a> <span class="k3">*</span>d <span class="k3">=</span> <a href="http://www.allegro.cc/manual/al_create_display"><span class="a">al_create_display</span></a><span class="k2">(</span><span class="n">800</span>, <span class="n">800</span><span class="k2">)</span><span class="k2">;</span>
<span class="number">  9</span>
<span class="number"> 10</span>    al_init_native_dialog_addon<span class="k2">(</span><span class="k2">)</span><span class="k2">;</span>
<span class="number"> 11</span>
<span class="number"> 12</span>    <span class="k1">auto</span> fc <span class="k3">=</span> <a href="http://www.allegro.cc/manual/al_create_native_file_dialog"><span class="a">al_create_native_file_dialog</span></a><span class="k2">(</span><span class="s">"/"</span>, <span class="s">"Chooser"</span>, NULL, ALLEGRO_FILECHOOSER_MULTIPLE<span class="k2">)</span><span class="k2">;</span>
<span class="number"> 13</span>    <a href="http://www.allegro.cc/manual/al_show_native_file_dialog"><span class="a">al_show_native_file_dialog</span></a><span class="k2">(</span>d, fc<span class="k2">)</span><span class="k2">;</span>
<span class="number"> 14</span>
<span class="number"> 15</span>    <a href="http://www.allegro.cc/manual/al_destroy_native_file_dialog"><span class="a">al_destroy_native_file_dialog</span></a><span class="k2">(</span>fc<span class="k2">)</span><span class="k2">;</span>
<span class="number"> 16</span>    <a href="http://www.allegro.cc/manual/al_destroy_display"><span class="a">al_destroy_display</span></a><span class="k2">(</span>d<span class="k2">)</span><span class="k2">;</span>
<span class="number"> 17</span>
<span class="number"> 18</span>    <span class="k1">return</span> <span class="n">0</span><span class="k2">;</span>
<span class="number"> 19</span><span class="k2">}</span>
</div></div><p>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Aksel Huff)</author>
		<pubDate>Mon, 11 Apr 2022 06:17:13 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>What error message do you get? If you only changed code, you could try just undoing your changes. Or use a versioning system like Git to keep track of what you have done. Et cetera. <img src="http://www.allegro.cc/forums/smileys/smiley.gif" alt=":)" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (torhu)</author>
		<pubDate>Mon, 11 Apr 2022 07:35:55 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Unfortunately for me, I have not developed good version control habits. I had thought I had made a commit when I had the dialog working, but I went back through commits and I couldn&#39;t find a state where it was working. I guess I had got it working, then broke it before making any commits...</p><p>When I step through the code, it segfaults at <span class="source-code"><a href="http://www.allegro.cc/manual/al_show_native_file_dialog"><span class="a">al_show_native_file_dialog</span></a><span class="k2">(</span><span class="k2">)</span></span></p><p>All I get when I run the above code is the display being created, then crashing with <span class="source-code">Segmentation fault <span class="k2">(</span>core dumped<span class="k2">)</span></span></p><p>I have just figured out how to find the core dump and look at it with gdb and here is the stack frame (I have no idea what to make of this):</p><div class="source-code"><div class="toolbar"><span class="button numbers"><b>#</b></span><span class="button select">Select</span><span class="button expand">Expand</span></div><div class="inner"><span class="number">   1</span><span class="p">#0  __memmove_avx_unaligned_erms () at ../sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S:240</span>
<span class="number">   2</span><span class="p">#1  0x00007fe85cb6b79d in  () at /lib/x86_64-linux-gnu/libpng16.so.16</span>
<span class="number">   3</span><span class="p">#2  0x00007fe85cb5b538 in  () at /lib/x86_64-linux-gnu/libpng16.so.16</span>
<span class="number">   4</span><span class="p">#3  0x00007fe85cb5b9d8 in  () at /lib/x86_64-linux-gnu/libpng16.so.16</span>
<span class="number">   5</span><span class="p">#4  0x00007fe85cb5bcbb in  () at /lib/x86_64-linux-gnu/libpng16.so.16</span>
<span class="number">   6</span><span class="p">#5  0x00007fe85cb5beab in png_process_data () at /lib/x86_64-linux-gnu/libpng16.so.16</span>
<span class="number">   7</span><span class="p">#6  0x00007fe8502c2cd9 in  () at /snap/code/93/usr/lib/x86_64-linux-gnu/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-png.so</span>
<span class="number">   8</span><span class="p">#7  0x00007fe85d649281 in  () at /lib/x86_64-linux-gnu/libgdk_pixbuf-2.0.so.0</span>
<span class="number">   9</span><span class="p">#8  0x00007fe85d649b15 in gdk_pixbuf_loader_close () at /lib/x86_64-linux-gnu/libgdk_pixbuf-2.0.so.0</span>
<span class="number">  10</span><span class="p">#9  0x00007fe85d646233 in  () at /lib/x86_64-linux-gnu/libgdk_pixbuf-2.0.so.0</span>
<span class="number">  11</span><span class="p">#10 0x00007fe85d6472c1 in gdk_pixbuf_new_from_stream () at /lib/x86_64-linux-gnu/libgdk_pixbuf-2.0.so.0</span>
<span class="number">  12</span><span class="p">#11 0x00007fe85e1ad57f in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0</span>
<span class="number">  13</span><span class="p">#12 0x00007fe85e1b1be0 in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0</span>
<span class="number">  14</span><span class="p">#13 0x00007fe85e1a9afe in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0</span>
<span class="number">  15</span><span class="p">#14 0x00007fe85e1aa278 in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0</span>
<span class="number">  16</span><span class="p">#15 0x00007fe85e1aa394 in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0</span>
<span class="number">  17</span><span class="p">#16 0x00007fe85e1aa4e0 in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0</span>
<span class="number">  18</span><span class="p">#17 0x00007fe85e1be191 in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0</span>
<span class="number">  19</span><span class="p">#18 0x00007fe85e118417 in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0</span>
<span class="number">  20</span><span class="p">#19 0x00007fe85e11c75e in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0</span>
<span class="number">  21</span><span class="p">#20 0x00007fe85e1be987 in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0</span>
<span class="number">  22</span><span class="p">#21 0x00007fe85e27f441 in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0</span>
<span class="number">  23</span><span class="p">#22 0x00007fe85e27fce6 in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0</span>
<span class="number">  24</span><span class="p">#23 0x00007fe85e27fdd6 in gtk_widget_get_preferred_width () at /lib/x86_64-linux-gnu/libgtk-3.so.0</span>
<span class="number">  25</span><span class="p">#24 0x00007fe85e28044e in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0</span>
<span class="number">  26</span><span class="p">#25 0x00007fe85e118417 in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0</span>
<span class="number">  27</span><span class="p">#26 0x00007fe85e11c75e in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0</span>
<span class="number">  28</span><span class="p">#27 0x00007fe85e0d36c7 in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0</span>
<span class="number">  29</span><span class="p">#28 0x00007fe85e27f441 in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0</span>
<span class="number">  30</span><span class="p">#29 0x00007fe85e27fce6 in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0</span>
<span class="number">  31</span><span class="p">#30 0x00007fe85e27fdd6 in gtk_widget_get_preferred_width () at /lib/x86_64-linux-gnu/libgtk-3.so.0</span>
<span class="number">  32</span><span class="p">#31 0x00007fe85e21fc7e in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0</span>
<span class="number">  33</span><span class="p">#32 0x00007fe85e27f441 in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0</span>
<span class="number">  34</span><span class="k3">-</span><span class="k3">-</span>Type <span class="k3">&lt;</span>RET&gt; <span class="k1">for</span> more, q to quit, c to <span class="k1">continue</span> without paging--
<span class="number">  35</span><span class="p">#33 0x00007fe85e27fc52 in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0</span>
<span class="number">  36</span><span class="p">#34 0x00007fe85e27fdd6 in gtk_widget_get_preferred_width () at /lib/x86_64-linux-gnu/libgtk-3.so.0</span>
<span class="number">  37</span><span class="p">#35 0x00007fe85e0c5c6f in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0</span>
<span class="number">  38</span><span class="p">#36 0x00007fe85e118417 in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0</span>
<span class="number">  39</span><span class="p">#37 0x00007fe85e11c75e in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0</span>
<span class="number">  40</span><span class="p">#38 0x00007fe85e0c6737 in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0</span>
<span class="number">  41</span><span class="p">#39 0x00007fe85e27f441 in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0</span>
<span class="number">  42</span><span class="p">#40 0x00007fe85e27fce6 in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0</span>
<span class="number">  43</span><span class="p">#41 0x00007fe85e27fdd6 in gtk_widget_get_preferred_width () at /lib/x86_64-linux-gnu/libgtk-3.so.0</span>
<span class="number">  44</span><span class="p">#42 0x00007fe85e2864fa in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0</span>
<span class="number">  45</span><span class="p">#43 0x00007fe85e118417 in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0</span>
<span class="number">  46</span><span class="p">#44 0x00007fe85e11c75e in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0</span>
<span class="number">  47</span><span class="p">#45 0x00007fe85e28720b in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0</span>
<span class="number">  48</span><span class="p">#46 0x00007fe85e27f441 in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0</span>
<span class="number">  49</span><span class="p">#47 0x00007fe85e27fce6 in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0</span>
<span class="number">  50</span><span class="p">#48 0x00007fe85e27fdd6 in gtk_widget_get_preferred_width () at /lib/x86_64-linux-gnu/libgtk-3.so.0</span>
<span class="number">  51</span><span class="p">#49 0x00007fe85e0c5c6f in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0</span>
<span class="number">  52</span><span class="p">#50 0x00007fe85e118417 in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0</span>
<span class="number">  53</span><span class="p">#51 0x00007fe85e11c75e in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0</span>
<span class="number">  54</span><span class="p">#52 0x00007fe85e0c6737 in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0</span>
<span class="number">  55</span><span class="p">#53 0x00007fe85e27f441 in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0</span>
<span class="number">  56</span><span class="p">#54 0x00007fe85e27fce6 in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0</span>
<span class="number">  57</span><span class="p">#55 0x00007fe85e27fdd6 in gtk_widget_get_preferred_width () at /lib/x86_64-linux-gnu/libgtk-3.so.0</span>
<span class="number">  58</span><span class="p">#56 0x00007fe85e0c09b9 in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0</span>
<span class="number">  59</span><span class="p">#57 0x00007fe85e25b2ba in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0</span>
<span class="number">  60</span><span class="p">#58 0x00007fe85e27f441 in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0</span>
<span class="number">  61</span><span class="p">#59 0x00007fe85e27fce6 in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0</span>
<span class="number">  62</span><span class="p">#60 0x00007fe85e27fdd6 in gtk_widget_get_preferred_width () at /lib/x86_64-linux-gnu/libgtk-3.so.0</span>
<span class="number">  63</span><span class="p">#61 0x00007fe85e0c5c6f in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0</span>
<span class="number">  64</span><span class="p">#62 0x00007fe85e118417 in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0</span>
<span class="number">  65</span><span class="p">#63 0x00007fe85e11c75e in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0</span>
<span class="number">  66</span><span class="p">#64 0x00007fe85e0c6737 in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0</span>
<span class="number">  67</span><span class="p">#65 0x00007fe85e27f441 in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0</span>
<span class="number">  68</span><span class="k3">-</span><span class="k3">-</span>Type <span class="k3">&lt;</span>RET&gt; <span class="k1">for</span> more, q to quit, c to <span class="k1">continue</span> without paging--
<span class="number">  69</span><span class="p">#66 0x00007fe85e27fce6 in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0</span>
<span class="number">  70</span><span class="p">#67 0x00007fe85e27fdd6 in gtk_widget_get_preferred_width () at /lib/x86_64-linux-gnu/libgtk-3.so.0</span>
<span class="number">  71</span><span class="p">#68 0x00007fe85e28044e in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0</span>
<span class="number">  72</span><span class="p">#69 0x00007fe85e217d42 in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0</span>
<span class="number">  73</span><span class="p">#70 0x00007fe85e118417 in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0</span>
<span class="number">  74</span><span class="p">#71 0x00007fe85e11c75e in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0</span>
<span class="number">  75</span><span class="p">#72 0x00007fe85e217197 in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0</span>
<span class="number">  76</span><span class="p">#73 0x00007fe85e27f441 in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0</span>
<span class="number">  77</span><span class="p">#74 0x00007fe85e27fce6 in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0</span>
<span class="number">  78</span><span class="p">#75 0x00007fe85e27fdd6 in gtk_widget_get_preferred_width () at /lib/x86_64-linux-gnu/libgtk-3.so.0</span>
<span class="number">  79</span><span class="p">#76 0x00007fe85e0c5c6f in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0</span>
<span class="number">  80</span><span class="p">#77 0x00007fe85e118417 in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0</span>
<span class="number">  81</span><span class="p">#78 0x00007fe85e11c75e in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0</span>
<span class="number">  82</span><span class="p">#79 0x00007fe85e0c6737 in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0</span>
<span class="number">  83</span><span class="p">#80 0x00007fe85e27f441 in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0</span>
<span class="number">  84</span><span class="p">#81 0x00007fe85e27fce6 in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0</span>
<span class="number">  85</span><span class="p">#82 0x00007fe85e27fdd6 in gtk_widget_get_preferred_width () at /lib/x86_64-linux-gnu/libgtk-3.so.0</span>
<span class="number">  86</span><span class="p">#83 0x00007fe85e0c5c6f in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0</span>
<span class="number">  87</span><span class="p">#84 0x00007fe85e118417 in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0</span>
<span class="number">  88</span><span class="p">#85 0x00007fe85e11c75e in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0</span>
<span class="number">  89</span><span class="p">#86 0x00007fe85e0c6737 in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0</span>
<span class="number">  90</span><span class="p">#87 0x00007fe85e27f441 in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0</span>
<span class="number">  91</span><span class="p">#88 0x00007fe85e27fce6 in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0</span>
<span class="number">  92</span><span class="p">#89 0x00007fe85e27fdd6 in gtk_widget_get_preferred_width () at /lib/x86_64-linux-gnu/libgtk-3.so.0</span>
<span class="number">  93</span><span class="p">#90 0x00007fe85e0c5c6f in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0</span>
<span class="number">  94</span><span class="p">#91 0x00007fe85e118417 in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0</span>
<span class="number">  95</span><span class="p">#92 0x00007fe85e11c75e in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0</span>
<span class="number">  96</span><span class="p">#93 0x00007fe85e0c6737 in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0</span>
<span class="number">  97</span><span class="p">#94 0x00007fe85e27f441 in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0</span>
<span class="number">  98</span><span class="p">#95 0x00007fe85e27fce6 in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0</span>
<span class="number">  99</span><span class="p">#96 0x00007fe85e27fdd6 in gtk_widget_get_preferred_width () at /lib/x86_64-linux-gnu/libgtk-3.so.0</span>
<span class="number"> 100</span><span class="p">#97 0x00007fe85e34143a in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0</span>
<span class="number"> 101</span><span class="p">#98 0x00007fe85e27f441 in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0</span>
<span class="number"> 102</span><span class="k3">-</span><span class="k3">-</span>Type <span class="k3">&lt;</span>RET&gt; <span class="k1">for</span> more, q to quit, c to <span class="k1">continue</span> without paging--
<span class="number"> 103</span><span class="p">#99 0x00007fe85e27fce6 in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0</span>
<span class="number"> 104</span><span class="p">#100 0x00007fe85e27fdd6 in gtk_widget_get_preferred_width () at /lib/x86_64-linux-gnu/libgtk-3.so.0</span>
<span class="number"> 105</span><span class="p">#101 0x00007fe85e280124 in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0</span>
<span class="number"> 106</span><span class="p">#102 0x00007fe85e342bb1 in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0</span>
<span class="number"> 107</span><span class="p">#103 0x00007fe85e34713a in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0</span>
<span class="number"> 108</span><span class="p">#104 0x00007fe85de45802 in g_closure_invoke () at /lib/x86_64-linux-gnu/libgobject-2.0.so.0</span>
<span class="number"> 109</span><span class="p">#105 0x00007fe85de59962 in  () at /lib/x86_64-linux-gnu/libgobject-2.0.so.0</span>
<span class="number"> 110</span><span class="p">#106 0x00007fe85de64bbe in g_signal_emit_valist () at /lib/x86_64-linux-gnu/libgobject-2.0.so.0</span>
<span class="number"> 111</span><span class="p">#107 0x00007fe85de650f3 in g_signal_emit () at /lib/x86_64-linux-gnu/libgobject-2.0.so.0</span>
<span class="number"> 112</span><span class="p">#108 0x00007fe85e33721b in gtk_widget_realize () at /lib/x86_64-linux-gnu/libgtk-3.so.0</span>
<span class="number"> 113</span><span class="p">#109 0x00007fe85e344fd6 in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0</span>
<span class="number"> 114</span><span class="p">#110 0x00007fe85de45802 in g_closure_invoke () at /lib/x86_64-linux-gnu/libgobject-2.0.so.0</span>
<span class="number"> 115</span><span class="p">#111 0x00007fe85de59962 in  () at /lib/x86_64-linux-gnu/libgobject-2.0.so.0</span>
<span class="number"> 116</span><span class="p">#112 0x00007fe85de64bbe in g_signal_emit_valist () at /lib/x86_64-linux-gnu/libgobject-2.0.so.0</span>
<span class="number"> 117</span><span class="p">#113 0x00007fe85de650f3 in g_signal_emit () at /lib/x86_64-linux-gnu/libgobject-2.0.so.0</span>
<span class="number"> 118</span><span class="p">#114 0x00007fe85e3311ce in gtk_widget_show () at /lib/x86_64-linux-gnu/libgtk-3.so.0</span>
<span class="number"> 119</span><span class="p">#115 0x00007fe85e1493a8 in gtk_dialog_run () at /lib/x86_64-linux-gnu/libgtk-3.so.0</span>
<span class="number"> 120</span><span class="p">#116 0x00007fe85ea5d034 in  () at /lib/x86_64-linux-gnu/liballegro_dialog.so.5.2</span>
<span class="number"> 121</span><span class="p">#117 0x00007fe85dd58be8 in  () at /lib/x86_64-linux-gnu/libglib-2.0.so.0</span>
<span class="number"> 122</span><span class="p">#118 0x00007fe85dd5804e in g_main_context_dispatch () at /lib/x86_64-linux-gnu/libglib-2.0.so.0</span>
<span class="number"> 123</span><span class="p">#119 0x00007fe85dd58400 in  () at /lib/x86_64-linux-gnu/libglib-2.0.so.0</span>
<span class="number"> 124</span><span class="p">#120 0x00007fe85dd586f3 in g_main_loop_run () at /lib/x86_64-linux-gnu/libglib-2.0.so.0</span>
<span class="number"> 125</span><span class="p">#121 0x00007fe85e1e412d in gtk_main () at /lib/x86_64-linux-gnu/libgtk-3.so.0</span>
<span class="number"> 126</span><span class="p">#122 0x00007fe85ea5ea0f in  () at /lib/x86_64-linux-gnu/liballegro_dialog.so.5.2</span>
<span class="number"> 127</span><span class="p">#123 0x00007fe85dd81ad1 in  () at /lib/x86_64-linux-gnu/libglib-2.0.so.0</span>
<span class="number"> 128</span><span class="p">#124 0x00007fe85dceb609 in start_thread (arg=&lt;optimized out&gt;) at pthread_create.c:477</span>
<span class="number"> 129</span><span class="p">#125 0x00007fe85e866163 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95</span>
</div></div><p>

I&#39;m starting to think there is something wrong with either my build setup, my OS, or something else because I just tried to build the native file chooser example and it also segfaults.</p><p>EDIT: I discovered something! If I run the example with sudo, it works! So I guess this isn&#39;t an Allegro5 issue, and more of a Linux problem I&#39;m having.</p><p>Anyone able to assist me with figuring out why my applications suddenly need to be run with sudo?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Aksel Huff)</author>
		<pubDate>Mon, 11 Apr 2022 11:41:37 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Are you trying to write files in protected locations? They will fail to open.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Edgar Reynaldo)</author>
		<pubDate>Mon, 11 Apr 2022 18:07:15 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I don&#39;t think I was trying to open something that would need special permissions, just my home dir. The native file dialog example also segfaulted.</p><p>Ok, it looks like I don&#39;t get a segfault if I run the example from the terminal. Or from the bash terminal in vscode. I only get a segfault when I press the launch button, which I guess launches the app with cmake?</p><p>So maybe it&#39;s an issue I&#39;m having with vscode.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Aksel Huff)</author>
		<pubDate>Mon, 11 Apr 2022 22:42:42 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>First thing to do is check return values of functions that can fail.</p><p>If a resource like an image fails to load it will be null and access will seg fault that way too.</p><div class="quote_container"><div class="title"><a href="">console</a> said:</div><div class="quote"><p>
#5  0x00007fe85cb5beab in png_process_data () at /lib/x86_64-linux-gnu/libpng16.so.16
</p></div></div><p>
It probably had an error trying to load an unsupported png file.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Edgar Reynaldo)</author>
		<pubDate>Tue, 12 Apr 2022 00:57:21 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>A hunch: you&#39;re using relative paths to load a file (e.g., PNG as an <span class="source-code"><a href="http://www.allegro.cc/manual/ALLEGRO_BITMAP"><span class="a">ALLEGRO_BITMAP</span></a></span>) and when running from the terminal, the relative path resolves correctly. But when running from VS Code, your working directory <b>is not</b> the same as the terminal, and so the relative path resolves differently to a file that does not exist, resulting in a crash.</p><p>Example:</p><div class="source-code snippet"><div class="inner"><pre><a href="http://www.allegro.cc/manual/al_load_bitmap"><span class="a">al_load_bitmap</span></a><span class="k2">(</span><span class="s">"foo/bar.png"</span><span class="k2">)</span>
<span class="c">// If your working directory is ~/project, then this will resolve to ~/project/foo/bar.png</span>
<span class="c">// But if your relative directory is /usr/bin, this will resolve to /usr/bin/foo/bar.png -- which probably isn't correct!</span>
</pre></div></div><p>

You probably have to configure your run target in VS Code to have the project&#39;s base path as your working directory.</p><p>(If this isn&#39;t the case - apologies! Like I said, it&#39;s just a hunch).
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Erin Maus)</author>
		<pubDate>Tue, 12 Apr 2022 01:05:02 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I added a line to check for the return values of the display and the filechooser, and both are not null.</p><p>I&#39;m not sure about how to go about the libpng error, as I am not loading any images.</p><p>This is my current code that I am trying to debug:</p><div class="source-code"><div class="toolbar"><span class="button numbers"><b>#</b></span><span class="button select">Select</span><span class="button expand">Expand</span></div><div class="inner"><span class="number">  1</span><span class="p">#include &lt;stdio.h&gt;</span>
<span class="number">  2</span><span class="p">#include &lt;allegro5/allegro.h&gt;</span>
<span class="number">  3</span><span class="p">#include &lt;allegro5/allegro_native_dialog.h&gt;</span>
<span class="number">  4</span>
<span class="number">  5</span><span class="k1">int</span> main<span class="k2">(</span><span class="k2">)</span>
<span class="number">  6</span><span class="k2">{</span>
<span class="number">  7</span>   <a href="http://www.allegro.cc/manual/al_init"><span class="a">al_init</span></a><span class="k2">(</span><span class="k2">)</span><span class="k2">;</span>
<span class="number">  8</span>   al_init_native_dialog_addon<span class="k2">(</span><span class="k2">)</span><span class="k2">;</span>
<span class="number">  9</span>
<span class="number"> 10</span>   <a href="http://www.allegro.cc/manual/ALLEGRO_DISPLAY"><span class="a">ALLEGRO_DISPLAY</span></a> <span class="k3">*</span>disp <span class="k3">=</span> <a href="http://www.allegro.cc/manual/al_create_display"><span class="a">al_create_display</span></a><span class="k2">(</span><span class="n">800</span>, <span class="n">800</span><span class="k2">)</span><span class="k2">;</span>
<span class="number"> 11</span>
<span class="number"> 12</span>   <a href="http://www.allegro.cc/manual/ALLEGRO_FILECHOOSER"><span class="a">ALLEGRO_FILECHOOSER</span></a> <span class="k3">*</span>fc <span class="k3">=</span> <a href="http://www.allegro.cc/manual/al_create_native_file_dialog"><span class="a">al_create_native_file_dialog</span></a><span class="k2">(</span>NULL, <span class="s">"Test"</span>, NULL, ALLEGRO_FILECHOOSER_FILE_MUST_EXIST<span class="k2">)</span><span class="k2">;</span>
<span class="number"> 13</span>
<span class="number"> 14</span>   <span class="k1">if</span> <span class="k2">(</span><span class="k3">!</span>fc <span class="k3">|</span><span class="k3">|</span> <span class="k3">!</span>disp<span class="k2">)</span> <span class="k1">return</span> <span class="n">1</span><span class="k2">;</span>
<span class="number"> 15</span>   
<span class="number"> 16</span>   <a href="http://www.allegro.cc/manual/al_show_native_file_dialog"><span class="a">al_show_native_file_dialog</span></a><span class="k2">(</span>disp, fc<span class="k2">)</span><span class="k2">;</span>
<span class="number"> 17</span>
<span class="number"> 18</span>   <span class="k1">if</span> <span class="k2">(</span><a href="http://www.allegro.cc/manual/al_get_native_file_dialog_count"><span class="a">al_get_native_file_dialog_count</span></a><span class="k2">(</span>fc<span class="k2">)</span> <span class="k3">&gt;</span> <span class="n">0</span><span class="k2">)</span>
<span class="number"> 19</span>   <span class="k2">{</span>
<span class="number"> 20</span>      <a href="http://www.delorie.com/djgpp/doc/libc/libc_624.html" target="_blank">printf</a><span class="k2">(</span><span class="s">"%s\n"</span>, <a href="http://www.allegro.cc/manual/al_get_native_file_dialog_path"><span class="a">al_get_native_file_dialog_path</span></a><span class="k2">(</span>fc, <span class="n">0</span><span class="k2">)</span><span class="k2">)</span><span class="k2">;</span>
<span class="number"> 21</span>   <span class="k2">}</span>
<span class="number"> 22</span>
<span class="number"> 23</span>   <a href="http://www.allegro.cc/manual/al_destroy_native_file_dialog"><span class="a">al_destroy_native_file_dialog</span></a><span class="k2">(</span>fc<span class="k2">)</span><span class="k2">;</span>
<span class="number"> 24</span>
<span class="number"> 25</span>   <a href="http://www.allegro.cc/manual/al_destroy_display"><span class="a">al_destroy_display</span></a><span class="k2">(</span>disp<span class="k2">)</span><span class="k2">;</span>
<span class="number"> 26</span>
<span class="number"> 27</span>   <span class="k1">return</span> <span class="n">0</span><span class="k2">;</span>
<span class="number"> 28</span><span class="k2">}</span>
</div></div><p>

Backtrace for this code:
</p><div class="source-code snippet"><div class="inner"><pre><span class="p">#0  __memmove_avx_unaligned_erms () at ../sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S:240</span>
<span class="p">#1  0x00007ffff60b079d in  () at /lib/x86_64-linux-gnu/libpng16.so.16</span>
<span class="p">#2  0x00007ffff60a0538 in  () at /lib/x86_64-linux-gnu/libpng16.so.16</span>
<span class="p">#3  0x00007ffff60a09d8 in  () at /lib/x86_64-linux-gnu/libpng16.so.16</span>
<span class="p">#4  0x00007ffff60a0cbb in  () at /lib/x86_64-linux-gnu/libpng16.so.16</span>
<span class="p">#5  0x00007ffff60a0eab in png_process_data () at /lib/x86_64-linux-gnu/libpng16.so.16</span>
<span class="p">#6  0x00007fffdc550cd9 in  () at /snap/code/93/usr/lib/x86_64-linux-gnu/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-png.so</span>
<span class="p">#7  0x00007ffff6b8e281 in  () at /lib/x86_64-linux-gnu/libgdk_pixbuf-2.0.so.0</span>
<span class="p">#8  0x00007ffff6b8eb15 in gdk_pixbuf_loader_close () at /lib/x86_64-linux-gnu/libgdk_pixbuf-2.0.so.0</span>
<span class="p">#9  0x00007ffff6b8b233 in  () at /lib/x86_64-linux-gnu/libgdk_pixbuf-2.0.so.0</span>
<span class="p">#10 0x00007ffff6b8c2c1 in gdk_pixbuf_new_from_stream () at /lib/x86_64-linux-gnu/libgdk_pixbuf-2.0.so.0</span>
<span class="p">#11 0x00007ffff76f257f in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0</span>
</pre></div></div><p>

Successfully prints the selected file to the terminal when run from terminal, crashes when run from vscode.</p><p>Could the native file dialog be using relative paths internally, which would make Erin&#39;s suggestion make sense?</p><p>EDIT:</p><p>I think cmake has something to do with this? If I launch the program using the &quot;Run and Debug&quot; window in vscode, it does not segfault. Just when I do ./test in the CMake/Launch terminal, and when I press the Launch button at the bottom. Hmmmmmmmmmmm.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Aksel Huff)</author>
		<pubDate>Tue, 12 Apr 2022 01:06:28 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Try calling <a href="https://liballeg.org/a5docs/trunk/fshook.html#al_get_current_directory">al_get_current_directory</a> after al_init, and see what it returns. Does it vary depending on how you run the program?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (torhu)</author>
		<pubDate>Tue, 12 Apr 2022 02:29:45 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>It does not vary, when it runs properly and when it seg faults it spits out <span class="source-code"><span class="k3">/</span>home<span class="k3">/</span>aksel<span class="k3">/</span>dev<span class="k3">/</span>test<span class="k3">/</span>build</span></p><p>I should add that I have reinstalled vscode, and cmake, to no avail.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Aksel Huff)</author>
		<pubDate>Tue, 12 Apr 2022 04:50:29 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Ok, so it&#39;s different between when it works, and when it doesn&#39;t? I think that&#39;s the clue here, then <img src="http://www.allegro.cc/forums/smileys/smiley.gif" alt=":)" /></p><p>This is a common issue, it&#39;s about what the working folder is. If you load files from a relative path, which you probably should do for a game, you have to set what the basis of that path is. Someone else will tell you how, I hope <img src="http://www.allegro.cc/forums/smileys/grin.gif" alt=";D" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (torhu)</author>
		<pubDate>Tue, 12 Apr 2022 04:55:57 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>No it does not vary.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Aksel Huff)</author>
		<pubDate>Tue, 12 Apr 2022 04:56:43 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Ok, sorry. Someone that is more familiar with Linux will have to answer, then.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (torhu)</author>
		<pubDate>Tue, 12 Apr 2022 05:04:40 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I think the issue is within my configuration of vscode-cmake-tools. It only seg faults when run using cmake run in vscode. I have posted a question of stackexchange, as this appears (at least to me) to not be a programming issue per se.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Aksel Huff)</author>
		<pubDate>Tue, 12 Apr 2022 05:21:40 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Cool, maybe you could link to the SE issue? I&#39;m on there, and I&#39;m sure many others here are too.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (torhu)</author>
		<pubDate>Tue, 12 Apr 2022 05:29:25 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Here is the SE question: <a href="https://stackoverflow.com/questions/71832657/segfault-only-occurs-when-pressing-launch-debug-button-from-vscode">https://stackoverflow.com/questions/71832657/segfault-only-occurs-when-pressing-launch-debug-button-from-vscode</a></p><p>Thanks all for trying to help by the way.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Aksel Huff)</author>
		<pubDate>Tue, 12 Apr 2022 05:36:59 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>No problem, hope you figure it out.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (torhu)</author>
		<pubDate>Tue, 12 Apr 2022 05:47:07 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Oddly this wouldn’t run for me until I set the patterns argument to *.*</p><p>But then setting it back to NULL allowed it run again……so now Im confused!!
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Dizzy Egg)</author>
		<pubDate>Wed, 13 Apr 2022 00:15:44 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I&#39;m not sure if this was already addressed: did you check the permissions on your working directory? Who&#39;s the owner/group?</p><p>If your toolchain is creating/writing to that directory (it looks like it), be sure to check after your build.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Indeterminatus)</author>
		<pubDate>Wed, 13 Apr 2022 00:28:38 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I&#39;ve checked my repo folder and the build folder and both are me/me for group and owner.</p><p>I&#39;m still pretty new to Linux there could be something obvious I&#39;m not seeing.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Aksel Huff)</author>
		<pubDate>Wed, 13 Apr 2022 05:55:03 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I run into the same problem as you when compiling and running - but I found that you are using auto </p><p>- and to my naivety thought that it was a c++ only keyword - so, I renamed the source to .cpp, and compiled it using g++.</p><p>This does make it work.</p><p>Either that, or if you must use C, make that <span class="source-code"><span class="k1">auto</span> fc</span> instead a <span class="source-code"><a href="http://www.allegro.cc/manual/ALLEGRO_FILECHOOSER"><span class="a">ALLEGRO_FILECHOOSER</span></a> <span class="k3">*</span>fc <span class="k3">=</span></span></p><p>(edit) Oh, you had another example - in that second case I guess you are running into problems with permissions like the rest of the people here have said. (/edit)
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (gusnan)</author>
		<pubDate>Fri, 15 Apr 2022 05:40:55 +0000</pubDate>
	</item>
</rss>
