OpenPHDGuiding / phd2

PHD2 Guiding
https://openphdguiding.org
BSD 3-Clause "New" or "Revised" License
245 stars 111 forks source link

Fix compile error on Linux #1084

Closed bwdev01 closed 1 year ago

bwdev01 commented 1 year ago

Response to compile-time issue noted by Patrick: https://github.com/OpenPHDGuiding/phd2/issues/1083

d33psky commented 1 year ago

This looks like a compiler bug to me. Glad you found a workaround.

bwdev01 commented 1 year ago

I agree, this works fine on Windows and I don’t see why it should be a problem. Patrick was the one who discovered the Linux issue and proposed the solution. As it turns out, the revision basically mimics the way it was done in earlier releases so I suspect the original author took this approach for the same reason.

From: d33psky @. Sent: Thursday, June 29, 2023 12:19 PM To: OpenPHDGuiding/phd2 @.> Cc: bwdev01 @.>; Author @.> Subject: Re: [OpenPHDGuiding/phd2] Fix compile error on Linux (PR #1084)

This looks like a compiler bug to me. Glad you found a workaround.

— Reply to this email directly, view it on GitHub https://github.com/OpenPHDGuiding/phd2/pull/1084#issuecomment-1613673161 , or unsubscribe https://github.com/notifications/unsubscribe-auth/ADDHSVYAHW54JYSEXHLM5IDXNXII3ANCNFSM6AAAAAAZY4OJSU . You are receiving this because you authored the thread. https://github.com/notifications/beacon/ADDHSV4FGKL4BFQEJXKLYSDXNXII3A5CNFSM6AAAAAAZY4OJSWWGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTTAF2ZMS.gif Message ID: @. @.> >

agalasso commented 1 year ago

it's a legit bug, sorry I did not catch it in the code review of the earlier pr The wxBitmap instance on line 323 (in the code prior to this pr) gets destroyed after it is selected into tmpMdc -- its lifetime is the scope of the expression on line 323, so after that line the dc has selected a destroyed wxBitmap.