Re: have to use task manager to abort program

Mason Wheeler <[email protected]> Wed, 15 Mar 2017 15:23:57 +0000 (UTC)
Newsgroups gmane.comp.lib.sdl
Message-ID <[email protected]>
--===============8320921639594952440==
Content-Type: multipart/alternative; 
	boundary="----=_Part_678450_1678824389.1489591437461"

------=_Part_678450_1678824389.1489591437461
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

The code looks pretty straightforward.=C2=A0 There are three reasons why it=
 might not be quitting for you.
1) Most likely: you're never getting the SDL_QUIT event.2) SDL_DestroyRende=
rer is never returning for some reason.
3) SDL_DestroyWindow is never returning for some reason.
Probably #1 though.=C2=A0 Have you tried running it under a debugger to che=
ck on what's happening?
Mason

      From: speartip <[email protected]>
 To: [email protected]=20
 Sent: Wednesday, March 15, 2017 9:46 AM
 Subject: [SDL] have to use task manager to abort program
  =20
<!--#yiv7895684575 #yiv7895684575 #yiv7895684575 body {font-size:11;}#yiv78=
95684575 #yiv7895684575 font, #yiv7895684575 th, #yiv7895684575 td, #yiv789=
5684575 p {}#yiv7895684575 p, #yiv7895684575 td {font-size:11;}#yiv78956845=
75 a:link, #yiv7895684575 a:active, #yiv7895684575 a:visited {}#yiv78956845=
75 a:hover {text-decoration:underline;}#yiv7895684575 hr {height:0px;border=
:solid 0px;border-top-width:1px;}#yiv7895684575 h1, #yiv7895684575 h2 {font=
-family:"Trebuchet MS", Verdana, Arial, Helvetica, sans-serif;font-size:22p=
x;font-weight:bold;text-decoration:none;line-height:120%;color:#000000;}#yi=
v7895684575 #yiv7895684575 .yiv7895684575bodyline {border:1px solid;}#yiv78=
95684575 #yiv7895684575 .yiv7895684575gen {font-size:12px;}#yiv7895684575 .=
yiv7895684575genmed {font-size:11px;}#yiv7895684575 .yiv7895684575gensmall =
{font-size:10px;line-height:12px;}#yiv7895684575 .yiv7895684575gen, #yiv789=
5684575 .yiv7895684575genmed, #yiv7895684575 .yiv7895684575gensmall {}#yiv7=
895684575 a.yiv7895684575gen, #yiv7895684575 a.yiv7895684575genmed, #yiv789=
5684575 a.yiv7895684575gensmall {text-decoration:none;}#yiv7895684575 a.yiv=
7895684575gen:hover, #yiv7895684575 a.yiv7895684575genmed:hover, #yiv789568=
4575 a.yiv7895684575gensmall:hover {text-decoration:underline;}#yiv78956845=
75 #yiv7895684575 .yiv7895684575forumlink {font-weight:bold;font-size:12px;=
}#yiv7895684575 a.yiv7895684575forumlink {text-decoration:none;}#yiv7895684=
575 a.yiv7895684575forumlink:hover{text-decoration:underline;}#yiv789568457=
5 #yiv7895684575 .yiv7895684575postbody {font-size:12px;line-height:18px;}#=
yiv7895684575 a.yiv7895684575postlink:link {text-decoration:none;}#yiv78956=
84575 a.yiv7895684575postlink:visited {text-decoration:none;}#yiv7895684575=
 a.yiv7895684575postlink:hover {text-decoration:underline;}#yiv7895684575 #=
yiv7895684575 .yiv7895684575code {font-size:11px;color:#3FB753;border-style=
:solid;border-left-width:1px;border-top-width:1px;border-right-width:1px;bo=
rder-bottom-width:1px;}#yiv7895684575 .yiv7895684575quote {font-size:11px;c=
olor:#444444;line-height:125%;border-style:solid;border-left-width:1px;bord=
er-top-width:1px;border-right-width:1px;border-bottom-width:1px;}-->  What =
am I doing wrong here? This is lifted code. When the program runs it produc=
es a black screen with a geometric pattern which is fine. But it sticks, it=
 can only abort with task manager:
Second, it has no border (which is what I want) but I would like to be able=
 to toggle that rather than just watch it disappear b/c I use use 1920 x 10=
80 res.










| Code: |
| #include
#include
using namespace std;

int main(int argc, char* argv[])
{
=C2=A0 =C2=A0if (SDL_Init(SDL_INIT_VIDEO) =3D=3D 0) {
=C2=A0 =C2=A0=C2=A0 =C2=A0 =C2=A0 =C2=A0 SDL_Window* window =3D NULL;
=C2=A0 =C2=A0=C2=A0 =C2=A0 =C2=A0 =C2=A0 SDL_Renderer* renderer =3D NULL;

=C2=A0 =C2=A0=C2=A0 =C2=A0 =C2=A0 =C2=A0 if (SDL_CreateWindowAndRenderer(19=
20, 1080, 0, &window, &renderer) =3D=3D 0) {
=C2=A0 =C2=A0=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 SDL_bool done =3D SD=
L_FALSE;

=C2=A0 =C2=A0=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 while (!done) {
=C2=A0 =C2=A0=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 SDL_Ev=
ent event;

=C2=A0 =C2=A0=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 SDL_Se=
tRenderDrawColor(renderer, 0, 0, 0, SDL_ALPHA_OPAQUE);
=C2=A0 =C2=A0=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 SDL_Re=
nderClear(renderer);

=C2=A0 =C2=A0=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 SDL_Se=
tRenderDrawColor(renderer, 0, 0, 255, SDL_ALPHA_OPAQUE);
=C2=A0 =C2=A0=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 SDL_Re=
nderDrawLine(renderer, 320, 200, 300, 240);
=C2=A0 =C2=A0=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 SDL_Re=
nderDrawLine(renderer, 300, 240, 340, 240);
=C2=A0 =C2=A0=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 SDL_Re=
nderDrawLine(renderer, 340, 240, 320, 200);
=C2=A0 =C2=A0=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 SDL_Re=
nderPresent(renderer);

=C2=A0 =C2=A0=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 while =
(SDL_PollEvent(&event)) {
=C2=A0 =C2=A0=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
 =C2=A0 if (event.type =3D=3D SDL_QUIT) {
=C2=A0 =C2=A0=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
 =C2=A0 =C2=A0 =C2=A0 done =3D SDL_TRUE;
=C2=A0 =C2=A0=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
 =C2=A0 }
=C2=A0 =C2=A0=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 }
=C2=A0 =C2=A0=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 }
=C2=A0 =C2=A0=C2=A0 =C2=A0 =C2=A0 =C2=A0 }

=C2=A0 =C2=A0=C2=A0 =C2=A0 =C2=A0 =C2=A0 if (renderer) {
=C2=A0 =C2=A0=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 SDL_DestroyRenderer(=
renderer);
=C2=A0 =C2=A0=C2=A0 =C2=A0 =C2=A0 =C2=A0 }
=C2=A0 =C2=A0=C2=A0 =C2=A0 =C2=A0 =C2=A0 if (window) {
=C2=A0 =C2=A0=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 SDL_DestroyWindow(wi=
ndow);
=C2=A0 =C2=A0=C2=A0 =C2=A0 =C2=A0 =C2=A0 }
=C2=A0 =C2=A0=C2=A0 =C2=A0 }
=C2=A0 =C2=A0=C2=A0 =C2=A0 SDL_Quit();
=C2=A0 =C2=A0 =C2=A0 =C2=A0 return 0;

} |

 _______________________________________________
SDL mailing list
[email protected]
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


  =20
------=_Part_678450_1678824389.1489591437461
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<html><head></head><body><div style=3D"color:#000; background-color:#fff; f=
ont-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, =
sans-serif;font-size:13px"><div id=3D"yui_3_16_0_ym19_1_1489590875354_12794=
">The code looks pretty straightforward.&nbsp; There are three reasons why =
it might not be quitting for you.</div><div id=3D"yui_3_16_0_ym19_1_1489590=
875354_12793"><br></div><div id=3D"yui_3_16_0_ym19_1_1489590875354_12792">1=
) Most likely: you're never getting the SDL_QUIT event.</div><div id=3D"yui=
_3_16_0_ym19_1_1489590875354_12746" dir=3D"ltr">2) SDL_DestroyRenderer is n=
ever returning for some reason.<br></div><div id=3D"yui_3_16_0_ym19_1_14895=
90875354_12705" dir=3D"ltr"><span id=3D"yui_3_16_0_ym19_1_1489590875354_127=
61">3) </span>SDL_DestroyWindow is never returning for some reason.</div><d=
iv class=3D"qtdSeparateBR" id=3D"yui_3_16_0_ym19_1_1489590875354_12704"><di=
v id=3D"yui_3_16_0_ym19_1_1489590875354_12795"><br></div><div id=3D"yui_3_1=
6_0_ym19_1_1489590875354_12762">Probably #1 though.&nbsp; Have you tried ru=
nning it under a debugger to check on what's happening?</div><div id=3D"yui=
_3_16_0_ym19_1_1489590875354_12808"><br></div><div id=3D"yui_3_16_0_ym19_1_=
1489590875354_12809">Mason<br></div><br></div><div class=3D"yahoo_quoted" i=
d=3D"yui_3_16_0_ym19_1_1489590875354_12620" style=3D"display: block;">  <di=
v style=3D"font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lu=
cida Grande, sans-serif; font-size: 13px;" id=3D"yui_3_16_0_ym19_1_14895908=
75354_12619"> <div style=3D"font-family: HelveticaNeue, Helvetica Neue, Hel=
vetica, Arial, Lucida Grande, sans-serif; font-size: 16px;" id=3D"yui_3_16_=
0_ym19_1_1489590875354_12618"> <div dir=3D"ltr" id=3D"yui_3_16_0_ym19_1_148=
9590875354_12703"> <font id=3D"yui_3_16_0_ym19_1_1489590875354_12702" size=
=3D"2" face=3D"Arial"> <hr size=3D"1"> <b><span style=3D"font-weight:bold;"=
>From:</span></b> speartip &lt;[email protected]&gt;<br> <b><span style=
=3D"font-weight: bold;">To:</span></b> [email protected] <br> <b><span s=
tyle=3D"font-weight: bold;">Sent:</span></b> Wednesday, March 15, 2017 9:46=
 AM<br> <b><span style=3D"font-weight: bold;">Subject:</span></b> [SDL] hav=
e to use task manager to abort program<br> </font> </div> <div class=3D"y_m=
sg_container" id=3D"yui_3_16_0_ym19_1_1489590875354_12617"><br><div id=3D"y=
iv7895684575">


<style type=3D"text/css">
<!--

#yiv7895684575 =20










#yiv7895684575 =20
#yiv7895684575 body {
font-size:11;}

#yiv7895684575 =20
#yiv7895684575 font, #yiv7895684575 th, #yiv7895684575 td, #yiv7895684575 p=
 {}
#yiv7895684575 p, #yiv7895684575 td=09=09{font-size:11;}
#yiv7895684575 a:link, #yiv7895684575 a:active, #yiv7895684575 a:visited {}
#yiv7895684575 a:hover=09=09{text-decoration:underline;}
#yiv7895684575 hr=09{height:0px;border:solid 0px;border-top-width:1px;}
#yiv7895684575 h1, #yiv7895684575 h2=09=09{font-family:"Trebuchet MS", Verd=
ana, Arial, Helvetica, sans-serif;font-size:22px;font-weight:bold;text-deco=
ration:none;line-height:120%;color:#000000;}


#yiv7895684575 =20
#yiv7895684575 .yiv7895684575bodyline=09{border:1px solid;}


#yiv7895684575 =20
#yiv7895684575 .yiv7895684575gen {font-size:12px;}
#yiv7895684575 .yiv7895684575genmed {font-size:11px;}
#yiv7895684575 .yiv7895684575gensmall {font-size:10px;line-height:12px;}
#yiv7895684575 .yiv7895684575gen, #yiv7895684575 .yiv7895684575genmed, #yiv=
7895684575 .yiv7895684575gensmall {}
#yiv7895684575 a.yiv7895684575gen, #yiv7895684575 a.yiv7895684575genmed, #y=
iv7895684575 a.yiv7895684575gensmall {text-decoration:none;}
#yiv7895684575 a.yiv7895684575gen:hover, #yiv7895684575 a.yiv7895684575genm=
ed:hover, #yiv7895684575 a.yiv7895684575gensmall:hover=09{text-decoration:u=
nderline;}


#yiv7895684575 =20
#yiv7895684575 .yiv7895684575forumlink=09=09{font-weight:bold;font-size:12p=
x;}
#yiv7895684575 a.yiv7895684575forumlink =09{text-decoration:none;}
#yiv7895684575 a.yiv7895684575forumlink:hover{text-decoration:underline;}


#yiv7895684575 =20
#yiv7895684575 .yiv7895684575postbody {font-size:12px;line-height:18px;}
#yiv7895684575 a.yiv7895684575postlink:link=09{text-decoration:none;}
#yiv7895684575 a.yiv7895684575postlink:visited {text-decoration:none;}
#yiv7895684575 a.yiv7895684575postlink:hover {text-decoration:underline;}


#yiv7895684575 =20
#yiv7895684575 .yiv7895684575code {
font-size:11px;color:#3FB753;border-style:solid;border-left-width:1px;borde=
r-top-width:1px;border-right-width:1px;border-bottom-width:1px;}

#yiv7895684575 .yiv7895684575quote {
font-size:11px;color:#444444;line-height:125%;border-style:solid;border-lef=
t-width:1px;border-top-width:1px;border-right-width:1px;border-bottom-width=
:1px;}

-->
</style>

=09<div id=3D"yui_3_16_0_ym19_1_1489590875354_12616">

=09<div class=3D"yiv7895684575postbody" id=3D"yui_3_16_0_ym19_1_14895908753=
54_12615">What am I doing wrong here? This is lifted code. When the program=
 runs it produces a black screen with a geometric pattern which is fine. Bu=
t it sticks, it can only abort with task manager:<br>
Second, it has no border (which is what I want) but I would like to be able=
 to toggle that rather than just watch it disappear b/c I use use 1920 x 10=
80 res.<br>
<br>
<br>
<div id=3D"yui_3_16_0_ym19_1_1489590875354_12614" align=3D"center"><br><br>=
<br><br><br><br><br><table class=3D"yiv7895684575code yahoo-compose-table-c=
ard" id=3D"yui_3_16_0_ym19_1_1489590875354_12671" cellspacing=3D"1" cellpad=
ding=3D"2" align=3D"center" width=3D"90%" border=3D"0">
<tbody id=3D"yui_3_16_0_ym19_1_1489590875354_12670"><tr id=3D"yui_3_16_0_ym=
19_1_1489590875354_12700">=20
=09<td class=3D"yiv7895684575code_header" id=3D"yui_3_16_0_ym19_1_148959087=
5354_12699" align=3D"left">Code:</td>
</tr>
<tr id=3D"yui_3_16_0_ym19_1_1489590875354_12669">
=09<td class=3D"yiv7895684575code" id=3D"yui_3_16_0_ym19_1_1489590875354_12=
668" align=3D"left">#include<br>
#include<br>
using namespace std;<br>
<br>
int main(int argc, char* argv[])<br>
{<br>
&nbsp; &nbsp;if (SDL_Init(SDL_INIT_VIDEO) =3D=3D 0) {<br>
&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; SDL_Window* window =3D NULL;<br>
&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; SDL_Renderer* renderer =3D NULL;<b=
r>
<br>
&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; if (SDL_CreateWindowAndRenderer(19=
20, 1080, 0, &amp;window, &amp;renderer) =3D=3D 0) {<br>
&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SDL_bool done =3D SD=
L_FALSE;<br>
<br>
&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; while (!done) {<br>
&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SDL_Ev=
ent event;<br>
<br>
&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SDL_Se=
tRenderDrawColor(renderer, 0, 0, 0, SDL_ALPHA_OPAQUE);<br>
&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SDL_Re=
nderClear(renderer);<br>
<br>
&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SDL_Se=
tRenderDrawColor(renderer, 0, 0, 255, SDL_ALPHA_OPAQUE);<br>
&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SDL_Re=
nderDrawLine(renderer, 320, 200, 300, 240);<br>
&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SDL_Re=
nderDrawLine(renderer, 300, 240, 340, 240);<br>
&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SDL_Re=
nderDrawLine(renderer, 340, 240, 320, 200);<br>
&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SDL_Re=
nderPresent(renderer);<br>
<br>
&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; while =
(SDL_PollEvent(&amp;event)) {<br>
&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;=
 &nbsp; if (event.type =3D=3D SDL_QUIT) {<br>
&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;=
 &nbsp; &nbsp; &nbsp; done =3D SDL_TRUE;<br>
&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;=
 &nbsp; }<br>
&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br>
&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br>
&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; }<br>
<br>
&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; if (renderer) {<br>
&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SDL_DestroyRenderer(=
renderer);<br>
&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; }<br>
&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; if (window) {<br>
&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SDL_DestroyWindow(wi=
ndow);<br>
&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; }<br>
&nbsp; &nbsp;&nbsp; &nbsp; }<br>
&nbsp; &nbsp;&nbsp; &nbsp; SDL_Quit();<br>
&nbsp; &nbsp; &nbsp; &nbsp; return 0;<br>
<br>
}</td>
=09</tr>
</tbody></table></div></div>
=09</div>
</div>_______________________________________________<br>SDL mailing list<b=
r><a ymailto=3D"mailto:[email protected]" href=3D"mailto:[email protected]=
l.org">[email protected]</a><br><a href=3D"http://lists.libsdl.org/listi=
nfo.cgi/sdl-libsdl.org" target=3D"_blank">http://lists.libsdl.org/listinfo.=
cgi/sdl-libsdl.org</a><br><br><br></div> </div> </div>  </div></div></body>=
</html>
------=_Part_678450_1678824389.1489591437461--

--===============8320921639594952440==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
SDL mailing list
[email protected]
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

--===============8320921639594952440==--