Skip to content

Commit

Permalink
ddc_open_display(): always return DDCRC_ALREADY_OPEN if display open …
Browse files Browse the repository at this point in the history
…in current thread

Previously asserted failure if display already locked by thread but DREF_OPEN not
set in the Display_Ref.  However, this can occur if the client has created
a new Display_Ref.

Addresses the PowerDevil crash reported in issues #228 and #205.

However, this fix will probably cause failure within PowerDevil itself, which
never calls ddca_close_display(), but instead calls ddca_open_display() with
a new Display_Ref after return from suspend.
  • Loading branch information
rockowitz committed Oct 22, 2021
1 parent d51b243 commit 0fe1925
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/ddc/ddc_packet_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,16 @@ ddc_open_display(
goto bye;
}
// DBGMSF(debug, "lockrc = %s, DREF_OPEN = %s", psc_desc(lockrc), sbool(dref->flags&DREF_OPEN));
TRACED_ASSERT_IFF( ddcrc == DDCRC_ALREADY_OPEN, dref->flags & DREF_OPEN);
// assumes there is only one Display_Ref for a display
// DREF_OPEN flag will not be set if caller used a different Display_Ref on this open call
// TRACED_ASSERT_IFF( ddcrc == DDCRC_ALREADY_OPEN, dref->flags & DREF_OPEN);

if (dref->flags & DREF_OPEN) {
// if (dref->flags & DREF_OPEN) {
// ddcrc = DDCRC_ALREADY_OPEN;
// goto bye;
// }

if (lockrc == DDCRC_ALREADY_OPEN) {
ddcrc = DDCRC_ALREADY_OPEN;
goto bye;
}
Expand Down

0 comments on commit 0fe1925

Please sign in to comment.